Skip to content

Commit

Permalink
refactor: move providers
Browse files Browse the repository at this point in the history
  • Loading branch information
hschoenenberger committed Dec 30, 2024
1 parent 3df654f commit 2914b52
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 17 deletions.
8 changes: 4 additions & 4 deletions config/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,29 @@ services:
PrestaShop\Module\PsAccounts\Service\PsAccountsService:
class: PrestaShop\Module\PsAccounts\Service\PsAccountsService
public: true
factory: ['PrestaShop\Module\PsAccounts\ServiceContainer\StaticProvider', 'provide']
factory: ['PrestaShop\Module\PsAccounts\ServiceProvider\StaticProvider', 'provide']
arguments:
- 'PrestaShop\Module\PsAccounts\Service\PsAccountsService'

# FIXME: probably totally useless now
# PrestaShop\Module\PsAccounts\Service\PsBillingService:
# class: PrestaShop\Module\PsAccounts\Service\PsBillingService
# public: true
# factory: [ 'PrestaShop\Module\PsAccounts\ServiceContainer\StaticProvider', 'provide' ]
# factory: [ 'PrestaShop\Module\PsAccounts\ServiceProvider\StaticProvider', 'provide' ]
# arguments:
# - 'PrestaShop\Module\PsAccounts\Service\PsBillingService'

PrestaShop\Module\PsAccounts\Repository\UserTokenRepository:
class: PrestaShop\Module\PsAccounts\Repository\UserTokenRepository
public: true
factory: ['PrestaShop\Module\PsAccounts\ServiceContainer\StaticProvider', 'provide']
factory: ['PrestaShop\Module\PsAccounts\ServiceProvider\StaticProvider', 'provide']
arguments:
- 'PrestaShop\Module\PsAccounts\Repository\UserTokenRepository'

PrestaShop\Module\PsAccounts\Presenter\PsAccountsPresenter:
class: PrestaShop\Module\PsAccounts\Presenter\PsAccountsPresenter
public: true
factory: ['PrestaShop\Module\PsAccounts\ServiceContainer\StaticProvider', 'provide']
factory: ['PrestaShop\Module\PsAccounts\ServiceProvider\StaticProvider', 'provide']
arguments:
- 'PrestaShop\Module\PsAccounts\Presenter\PsAccountsPresenter'

4 changes: 4 additions & 0 deletions src/Polyfill/Traits/Controller/AjaxRender.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ trait AjaxRender
* @return void
*
* @throws PrestaShopException
*
* FIXME: this method might exit OR not
* TODO: rename to 'ajaxDie' & exit every time
*/
protected function ajaxRender($value = null, $controller = null, $method = null)
{
Expand All @@ -41,6 +44,7 @@ protected function ajaxRender($value = null, $controller = null, $method = null)
if (method_exists($controllerBaseClass, 'ajaxRender')) {
/* @phpstan-ignore-next-line */
parent::ajaxRender($value, $controller, $method);
//exit;
} else {
parent::ajaxDie($value, $controller, $method);
}
Expand Down
13 changes: 7 additions & 6 deletions src/ServiceContainer/PsAccountsContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
namespace PrestaShop\Module\PsAccounts\ServiceContainer;

use PrestaShop\Module\PsAccounts\Log\Logger as LoggerFactory;
use PrestaShop\Module\PsAccounts\ServiceProvider;
use PrestaShop\Module\PsAccounts\Vendor\Monolog\Logger;
use PrestaShop\Module\PsAccounts\Vendor\PrestaShopCorp\LightweightContainer\ServiceContainer\ServiceContainer;

Expand All @@ -35,12 +36,12 @@ class PsAccountsContainer extends ServiceContainer
* @var string[]
*/
protected $provides = [
Provider\ApiClientProvider::class,
Provider\CommandProvider::class,
Provider\DefaultProvider::class,
Provider\OAuth2Provider::class,
Provider\RepositoryProvider::class,
Provider\SessionProvider::class,
ServiceProvider\ApiClientProvider::class,
ServiceProvider\CommandProvider::class,
ServiceProvider\DefaultProvider::class,
ServiceProvider\OAuth2Provider::class,
ServiceProvider\RepositoryProvider::class,
ServiceProvider\SessionProvider::class,
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

namespace PrestaShop\Module\PsAccounts\ServiceContainer\Provider;
namespace PrestaShop\Module\PsAccounts\ServiceProvider;

use PrestaShop\Module\PsAccounts\Api\Client\AccountsClient;
use PrestaShop\Module\PsAccounts\Api\Client\ServicesBillingClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

namespace PrestaShop\Module\PsAccounts\ServiceContainer\Provider;
namespace PrestaShop\Module\PsAccounts\ServiceProvider;

use PrestaShop\Module\PsAccounts\Account\CommandHandler\DeleteUserShopHandler;
use PrestaShop\Module\PsAccounts\Account\CommandHandler\LinkShopHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

namespace PrestaShop\Module\PsAccounts\ServiceContainer\Provider;
namespace PrestaShop\Module\PsAccounts\ServiceProvider;

use PrestaShop\Module\PsAccounts\Account\LinkShop;
use PrestaShop\Module\PsAccounts\Adapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

namespace PrestaShop\Module\PsAccounts\ServiceContainer\Provider;
namespace PrestaShop\Module\PsAccounts\ServiceProvider;

use PrestaShop\Module\PsAccounts\Factory\PrestaShopSessionFactory;
use PrestaShop\Module\PsAccounts\Middleware\Oauth2Middleware;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

namespace PrestaShop\Module\PsAccounts\ServiceContainer\Provider;
namespace PrestaShop\Module\PsAccounts\ServiceProvider;

use PrestaShop\Module\PsAccounts\Account\Session\Firebase;
use PrestaShop\Module\PsAccounts\Account\Session\Firebase\OwnerSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

namespace PrestaShop\Module\PsAccounts\ServiceContainer\Provider;
namespace PrestaShop\Module\PsAccounts\ServiceProvider;

use PrestaShop\Module\PsAccounts\Account\LinkShop;
use PrestaShop\Module\PsAccounts\Account\Session\Firebase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/

namespace PrestaShop\Module\PsAccounts\ServiceContainer;
namespace PrestaShop\Module\PsAccounts\ServiceProvider;

class StaticProvider
{
Expand Down

0 comments on commit 2914b52

Please sign in to comment.