From b9b3754fbe10002b59c7462cd70c235e136b8eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20D?= Date: Sat, 11 Jun 2022 09:43:09 +0200 Subject: [PATCH] refactor: [WIP] Create base classes for account view and save. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rubén D --- .../Account/AccountControllerBase.php | 5 +- .../Controllers/Account/AccountSaveBase.php | 64 +++++++++++++++++++ .../Controllers/Account/AccountViewBase.php | 54 ++++++++++++++++ .../Controllers/Account/CopyController.php | 36 ++--------- .../Account/CopyPassController.php | 10 ++- .../Account/CopyPassHistoryController.php | 11 ++-- .../Controllers/Account/CreateController.php | 27 ++------ .../Controllers/Account/DeleteController.php | 4 +- .../Controllers/Account/EditController.php | 35 ++-------- .../Account/EditPassController.php | 31 ++------- .../Controllers/Account/IndexController.php | 3 + .../Account/RequestAccessController.php | 28 ++------ .../Account/SaveCopyController.php | 36 ++--------- .../Account/SaveCreateController.php | 37 ++--------- .../Account/SaveDeleteController.php | 7 +- .../Account/SaveEditController.php | 35 ++-------- .../Account/SaveEditPassController.php | 3 + .../Account/SaveEditRestoreController.php | 5 +- .../Account/SaveRequestController.php | 8 ++- .../Controllers/Account/SearchController.php | 7 +- .../Controllers/Account/ViewController.php | 29 ++------- .../Account/ViewHistoryController.php | 11 ++-- .../Account/ViewLinkController.php | 14 ++-- .../Account/ViewPassController.php | 3 + .../Account/ViewPassHistoryController.php | 3 + 25 files changed, 224 insertions(+), 282 deletions(-) create mode 100644 app/modules/web/Controllers/Account/AccountSaveBase.php create mode 100644 app/modules/web/Controllers/Account/AccountViewBase.php diff --git a/app/modules/web/Controllers/Account/AccountControllerBase.php b/app/modules/web/Controllers/Account/AccountControllerBase.php index 9e7ce908..847bb0a4 100644 --- a/app/modules/web/Controllers/Account/AccountControllerBase.php +++ b/app/modules/web/Controllers/Account/AccountControllerBase.php @@ -28,6 +28,9 @@ use SP\Core\Context\ContextBase; use SP\Domain\Account\Services\AccountAclService; use SP\Modules\Web\Controllers\ControllerBase; +/** + * AccountControllerBase + */ abstract class AccountControllerBase extends ControllerBase { private const LOGIN_NOT_REQUIRED = ['ViewLinkController']; @@ -38,7 +41,7 @@ abstract class AccountControllerBase extends ControllerBase * @throws \SP\Core\Exceptions\SessionTimeout * @throws \SP\Domain\Auth\Services\AuthException */ - protected function initialize(): void + final protected function initialize(): void { if (in_array(static::class, self::LOGIN_NOT_REQUIRED)) { $this->checkLoggedIn(); diff --git a/app/modules/web/Controllers/Account/AccountSaveBase.php b/app/modules/web/Controllers/Account/AccountSaveBase.php new file mode 100644 index 00000000..2a544fbf --- /dev/null +++ b/app/modules/web/Controllers/Account/AccountSaveBase.php @@ -0,0 +1,64 @@ +. + */ + +namespace SP\Modules\Web\Controllers\Account; + + +use SP\Core\Application; +use SP\Domain\Account\AccountPresetServiceInterface; +use SP\Domain\Account\AccountServiceInterface; +use SP\Domain\CustomField\CustomFieldServiceInterface; +use SP\Modules\Web\Controllers\Traits\JsonTrait; +use SP\Modules\Web\Forms\AccountForm; +use SP\Mvc\Controller\ItemTrait; +use SP\Mvc\Controller\WebControllerHelper; + +/** + * Class AccountSaveBase + */ +abstract class AccountSaveBase extends AccountControllerBase +{ + use JsonTrait, ItemTrait; + + protected AccountServiceInterface $accountService; + protected AccountForm $accountForm; + protected CustomFieldServiceInterface $customFieldService; + + public function __construct( + Application $application, + WebControllerHelper $webControllerHelper, + AccountServiceInterface $accountService, + AccountPresetServiceInterface $accountPresetService, + CustomFieldServiceInterface $customFieldService + ) { + parent::__construct( + $application, + $webControllerHelper + ); + + $this->accountService = $accountService; + $this->customFieldService = $customFieldService; + $this->accountForm = new AccountForm($application, $this->request, $accountPresetService); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/Account/AccountViewBase.php b/app/modules/web/Controllers/Account/AccountViewBase.php new file mode 100644 index 00000000..d294c980 --- /dev/null +++ b/app/modules/web/Controllers/Account/AccountViewBase.php @@ -0,0 +1,54 @@ +. + */ + +namespace SP\Modules\Web\Controllers\Account; + +use SP\Core\Application; +use SP\Core\UI\ThemeIcons; +use SP\Domain\Account\AccountServiceInterface; +use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; +use SP\Mvc\Controller\WebControllerHelper; + +/** + * A class for al viewable actions + */ +abstract class AccountViewBase extends AccountControllerBase +{ + protected AccountServiceInterface $accountService; + protected AccountHelper $accountHelper; + protected ThemeIcons $icons; + + public function __construct( + Application $application, + WebControllerHelper $webControllerHelper, + AccountServiceInterface $accountService, + AccountHelper $accountHelper + ) { + parent::__construct($application, $webControllerHelper); + + $this->accountService = $accountService; + $this->accountHelper = $accountHelper; + $this->icons = $this->theme->getIcons(); + } +} \ No newline at end of file diff --git a/app/modules/web/Controllers/Account/CopyController.php b/app/modules/web/Controllers/Account/CopyController.php index 4703ae42..2d2ee5fb 100644 --- a/app/modules/web/Controllers/Account/CopyController.php +++ b/app/modules/web/Controllers/Account/CopyController.php @@ -24,39 +24,16 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; -use SP\Core\UI\ThemeIcons; -use SP\Domain\Account\AccountServiceInterface; -use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; -use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; -final class CopyController extends AccountControllerBase +/** + * Class CopyController + */ +final class CopyController extends AccountViewBase { - private AccountHelper $accountHelper; - private ThemeIcons $icons; - private AccountServiceInterface $accountService; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountHelper $accountHelper, - AccountServiceInterface $accountService - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountHelper = $accountHelper; - $this->accountService = $accountService; - $this->icons = $this->theme->getIcons(); - } - /** * Copy action * @@ -94,10 +71,7 @@ final class CopyController extends AccountControllerBase } catch (Exception $e) { processException($e); - $this->eventDispatcher->notifyEvent( - 'exception', - new Event($e) - ); + $this->eventDispatcher->notifyEvent('exception', new Event($e)); if ($this->isAjax === false && !$this->view->isUpgraded()) { $this->upgradeView(); diff --git a/app/modules/web/Controllers/Account/CopyPassController.php b/app/modules/web/Controllers/Account/CopyPassController.php index 072ed7bb..6d820e28 100644 --- a/app/modules/web/Controllers/Account/CopyPassController.php +++ b/app/modules/web/Controllers/Account/CopyPassController.php @@ -28,21 +28,25 @@ namespace SP\Modules\Web\Controllers\Account; use SP\Core\Application; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; +use SP\Domain\Account\AccountServiceInterface; use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class CopyPassController + */ final class CopyPassController extends AccountControllerBase { use JsonTrait; - private \SP\Domain\Account\AccountServiceInterface $accountService; - private AccountPasswordHelper $accountPasswordHelper; + private AccountServiceInterface $accountService; + private AccountPasswordHelper $accountPasswordHelper; public function __construct( Application $application, WebControllerHelper $webControllerHelper, - \SP\Domain\Account\AccountServiceInterface $accountService, + AccountServiceInterface $accountService, AccountPasswordHelper $accountPasswordHelper, ) { parent::__construct( diff --git a/app/modules/web/Controllers/Account/CopyPassHistoryController.php b/app/modules/web/Controllers/Account/CopyPassHistoryController.php index f0c0596e..fa470771 100644 --- a/app/modules/web/Controllers/Account/CopyPassHistoryController.php +++ b/app/modules/web/Controllers/Account/CopyPassHistoryController.php @@ -24,25 +24,28 @@ namespace SP\Modules\Web\Controllers\Account; - use SP\Core\Application; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; +use SP\Domain\Account\AccountServiceInterface; use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class CopyPassHistoryController + */ final class CopyPassHistoryController extends AccountControllerBase { use JsonTrait; - private \SP\Domain\Account\AccountServiceInterface $accountService; - private AccountPasswordHelper $accountPasswordHelper; + private AccountServiceInterface $accountService; + private AccountPasswordHelper $accountPasswordHelper; public function __construct( Application $application, WebControllerHelper $webControllerHelper, - \SP\Domain\Account\AccountServiceInterface $accountService, + AccountServiceInterface $accountService, AccountPasswordHelper $accountPasswordHelper, ) { parent::__construct( diff --git a/app/modules/web/Controllers/Account/CreateController.php b/app/modules/web/Controllers/Account/CreateController.php index 47add5ba..4f33d62b 100644 --- a/app/modules/web/Controllers/Account/CreateController.php +++ b/app/modules/web/Controllers/Account/CreateController.php @@ -24,35 +24,16 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; -use SP\Core\UI\ThemeIcons; -use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; -use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; -final class CreateController extends AccountControllerBase +/** + * Class CreateController + */ +final class CreateController extends AccountViewBase { - private AccountHelper $accountHelper; - private ThemeIcons $icons; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountHelper $accountHelper - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountHelper = $accountHelper; - $this->icons = $this->theme->getIcons(); - } - /** * Create action */ diff --git a/app/modules/web/Controllers/Account/DeleteController.php b/app/modules/web/Controllers/Account/DeleteController.php index 33a96470..855ed702 100644 --- a/app/modules/web/Controllers/Account/DeleteController.php +++ b/app/modules/web/Controllers/Account/DeleteController.php @@ -24,7 +24,6 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\ActionsInterface; use SP\Core\Application; @@ -35,6 +34,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; +/** + * Class DeleteController + */ final class DeleteController extends AccountControllerBase { private AccountHelper $accountHelper; diff --git a/app/modules/web/Controllers/Account/EditController.php b/app/modules/web/Controllers/Account/EditController.php index 95067425..a03d3946 100644 --- a/app/modules/web/Controllers/Account/EditController.php +++ b/app/modules/web/Controllers/Account/EditController.php @@ -24,38 +24,16 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; -use SP\Core\UI\ThemeIcons; -use SP\Domain\Account\AccountServiceInterface; -use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; -use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; -final class EditController extends AccountControllerBase +/** + * Class EditController + */ +final class EditController extends AccountViewBase { - private AccountHelper $accountHelper; - private ThemeIcons $icons; - private AccountServiceInterface $accountService; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountHelper $accountHelper, - \SP\Domain\Account\AccountServiceInterface $accountService - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountHelper = $accountHelper; - $this->accountService = $accountService; - $this->icons = $this->theme->getIcons(); - } /** * Edit action @@ -96,10 +74,7 @@ final class EditController extends AccountControllerBase } catch (Exception $e) { processException($e); - $this->eventDispatcher->notifyEvent( - 'exception', - new Event($e) - ); + $this->eventDispatcher->notifyEvent('exception', new Event($e)); if ($this->isAjax === false && !$this->view->isUpgraded()) { $this->upgradeView(); diff --git a/app/modules/web/Controllers/Account/EditPassController.php b/app/modules/web/Controllers/Account/EditPassController.php index 29e3da85..c5b44dae 100644 --- a/app/modules/web/Controllers/Account/EditPassController.php +++ b/app/modules/web/Controllers/Account/EditPassController.php @@ -24,41 +24,18 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; -use SP\Core\UI\ThemeIcons; -use SP\Domain\Account\AccountServiceInterface; -use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; -use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; -final class EditPassController extends AccountControllerBase +/** + * Class EditPassController + */ +final class EditPassController extends AccountViewBase { - private AccountHelper $accountHelper; - private ThemeIcons $icons; - private \SP\Domain\Account\AccountServiceInterface $accountService; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountHelper $accountHelper, - AccountServiceInterface $accountService - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountHelper = $accountHelper; - $this->accountService = $accountService; - $this->icons = $this->theme->getIcons(); - } - /** * Obtener los datos para mostrar el interface para modificar la clave de cuenta * diff --git a/app/modules/web/Controllers/Account/IndexController.php b/app/modules/web/Controllers/Account/IndexController.php index 587e4bd1..44eec9dd 100644 --- a/app/modules/web/Controllers/Account/IndexController.php +++ b/app/modules/web/Controllers/Account/IndexController.php @@ -32,6 +32,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountSearchHelper; use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; +/** + * Class IndexController + */ final class IndexController extends AccountControllerBase { private AccountSearchHelper $accountSearchHelper; diff --git a/app/modules/web/Controllers/Account/RequestAccessController.php b/app/modules/web/Controllers/Account/RequestAccessController.php index 7de72efe..808b82bc 100644 --- a/app/modules/web/Controllers/Account/RequestAccessController.php +++ b/app/modules/web/Controllers/Account/RequestAccessController.php @@ -24,36 +24,16 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; -use SP\Domain\Account\AccountServiceInterface; -use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; -use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; -final class RequestAccessController extends AccountControllerBase +/** + * Class RequestAccessController + */ +final class RequestAccessController extends AccountViewBase { - private AccountHelper $accountHelper; - private AccountServiceInterface $accountService; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountHelper $accountHelper, - AccountServiceInterface $accountService - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountHelper = $accountHelper; - $this->accountService = $accountService; - } - /** * Obtener los datos para mostrar el interface de solicitud de cambios en una cuenta * diff --git a/app/modules/web/Controllers/Account/SaveCopyController.php b/app/modules/web/Controllers/Account/SaveCopyController.php index 78325e81..19684012 100644 --- a/app/modules/web/Controllers/Account/SaveCopyController.php +++ b/app/modules/web/Controllers/Account/SaveCopyController.php @@ -24,47 +24,19 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\Acl; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; use SP\Core\Exceptions\ValidationException; -use SP\Domain\Account\AccountServiceInterface; -use SP\Domain\CustomField\CustomFieldServiceInterface; use SP\Http\JsonResponse; -use SP\Modules\Web\Controllers\Traits\JsonTrait; -use SP\Modules\Web\Forms\AccountForm; -use SP\Mvc\Controller\ItemTrait; -use SP\Mvc\Controller\WebControllerHelper; -final class SaveCopyController extends AccountControllerBase +/** + * Class SaveCopyController + */ +final class SaveCopyController extends AccountSaveBase { - use JsonTrait, ItemTrait; - - private AccountServiceInterface $accountService; - private AccountForm $accountForm; - private CustomFieldServiceInterface $customFieldService; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountServiceInterface $accountService, - \SP\Domain\Account\AccountPresetServiceInterface $accountPresetService, - CustomFieldServiceInterface $customFieldService - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountService = $accountService; - $this->customFieldService = $customFieldService; - $this->accountForm = new AccountForm($application, $this->request, $accountPresetService); - } - /** * @return bool * @throws \JsonException diff --git a/app/modules/web/Controllers/Account/SaveCreateController.php b/app/modules/web/Controllers/Account/SaveCreateController.php index a964ed30..a89cf096 100644 --- a/app/modules/web/Controllers/Account/SaveCreateController.php +++ b/app/modules/web/Controllers/Account/SaveCreateController.php @@ -24,48 +24,19 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\Acl; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; use SP\Core\Exceptions\ValidationException; -use SP\Domain\Account\AccountPresetServiceInterface; -use SP\Domain\Account\AccountServiceInterface; -use SP\Domain\CustomField\CustomFieldServiceInterface; use SP\Http\JsonResponse; -use SP\Modules\Web\Controllers\Traits\JsonTrait; -use SP\Modules\Web\Forms\AccountForm; -use SP\Mvc\Controller\ItemTrait; -use SP\Mvc\Controller\WebControllerHelper; -final class SaveCreateController extends AccountControllerBase +/** + * Class SaveCreateController + */ +final class SaveCreateController extends AccountSaveBase { - use JsonTrait, ItemTrait; - - private AccountServiceInterface $accountService; - private AccountForm $accountForm; - private CustomFieldServiceInterface $customFieldService; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountServiceInterface $accountService, - AccountPresetServiceInterface $accountPresetService, - CustomFieldServiceInterface $customFieldService - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountService = $accountService; - $this->customFieldService = $customFieldService; - $this->accountForm = new AccountForm($application, $this->request, $accountPresetService); - } - /** * @return bool * @throws \JsonException diff --git a/app/modules/web/Controllers/Account/SaveDeleteController.php b/app/modules/web/Controllers/Account/SaveDeleteController.php index e3252cca..43d61725 100644 --- a/app/modules/web/Controllers/Account/SaveDeleteController.php +++ b/app/modules/web/Controllers/Account/SaveDeleteController.php @@ -37,12 +37,15 @@ use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\ItemTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class SaveDeleteController + */ final class SaveDeleteController extends AccountControllerBase { use JsonTrait, ItemTrait; - private \SP\Domain\Account\AccountServiceInterface $accountService; - private CustomFieldServiceInterface $customFieldService; + private AccountServiceInterface $accountService; + private CustomFieldServiceInterface $customFieldService; public function __construct( Application $application, diff --git a/app/modules/web/Controllers/Account/SaveEditController.php b/app/modules/web/Controllers/Account/SaveEditController.php index a18791e8..a017487f 100644 --- a/app/modules/web/Controllers/Account/SaveEditController.php +++ b/app/modules/web/Controllers/Account/SaveEditController.php @@ -28,43 +28,16 @@ namespace SP\Modules\Web\Controllers\Account; use Exception; use SP\Core\Acl\Acl; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; use SP\Core\Exceptions\ValidationException; -use SP\Domain\Account\AccountPresetServiceInterface; -use SP\Domain\CustomField\CustomFieldServiceInterface; use SP\Http\JsonResponse; -use SP\Modules\Web\Controllers\Traits\JsonTrait; -use SP\Modules\Web\Forms\AccountForm; -use SP\Mvc\Controller\ItemTrait; -use SP\Mvc\Controller\WebControllerHelper; -final class SaveEditController extends AccountControllerBase +/** + * Class SaveEditController + */ +final class SaveEditController extends AccountSaveBase { - use JsonTrait, ItemTrait; - - private \SP\Domain\Account\AccountServiceInterface $accountService; - private AccountForm $accountForm; - private CustomFieldServiceInterface $customFieldService; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - \SP\Domain\Account\AccountServiceInterface $accountService, - AccountPresetServiceInterface $accountPresetService, - CustomFieldServiceInterface $customFieldService - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountService = $accountService; - $this->customFieldService = $customFieldService; - $this->accountForm = new AccountForm($application, $this->request, $accountPresetService); - } - /** * Saves edit action * diff --git a/app/modules/web/Controllers/Account/SaveEditPassController.php b/app/modules/web/Controllers/Account/SaveEditPassController.php index 16c7b3a0..6103ec93 100644 --- a/app/modules/web/Controllers/Account/SaveEditPassController.php +++ b/app/modules/web/Controllers/Account/SaveEditPassController.php @@ -39,6 +39,9 @@ use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Modules\Web\Forms\AccountForm; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class SaveEditPassController + */ final class SaveEditPassController extends AccountControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/Account/SaveEditRestoreController.php b/app/modules/web/Controllers/Account/SaveEditRestoreController.php index e9a84a43..95f2a7fb 100644 --- a/app/modules/web/Controllers/Account/SaveEditRestoreController.php +++ b/app/modules/web/Controllers/Account/SaveEditRestoreController.php @@ -36,6 +36,9 @@ use SP\Http\JsonResponse; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class SaveEditRestoreController + */ final class SaveEditRestoreController extends AccountControllerBase { use JsonTrait; @@ -45,7 +48,7 @@ final class SaveEditRestoreController extends AccountControllerBase public function __construct( Application $application, WebControllerHelper $webControllerHelper, - \SP\Domain\Account\AccountServiceInterface $accountService + AccountServiceInterface $accountService ) { parent::__construct( $application, diff --git a/app/modules/web/Controllers/Account/SaveRequestController.php b/app/modules/web/Controllers/Account/SaveRequestController.php index a8cc6744..1d207cce 100644 --- a/app/modules/web/Controllers/Account/SaveRequestController.php +++ b/app/modules/web/Controllers/Account/SaveRequestController.php @@ -33,6 +33,7 @@ use SP\Core\Bootstrap\BootstrapBase; use SP\Core\Events\Event; use SP\Core\Events\EventMessage; use SP\Core\Exceptions\ValidationException; +use SP\Domain\Account\AccountServiceInterface; use SP\Domain\User\UserServiceInterface; use SP\Http\JsonResponse; use SP\Http\Uri; @@ -40,17 +41,20 @@ use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\ItemTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class SaveRequestController + */ final class SaveRequestController extends AccountControllerBase { use JsonTrait, ItemTrait; - private \SP\Domain\Account\AccountServiceInterface $accountService; + private AccountServiceInterface $accountService; private UserServiceInterface $userService; public function __construct( Application $application, WebControllerHelper $webControllerHelper, - \SP\Domain\Account\AccountServiceInterface $accountService, + AccountServiceInterface $accountService, UserServiceInterface $userService ) { parent::__construct( diff --git a/app/modules/web/Controllers/Account/SearchController.php b/app/modules/web/Controllers/Account/SearchController.php index 79b664b3..327cb8dd 100644 --- a/app/modules/web/Controllers/Account/SearchController.php +++ b/app/modules/web/Controllers/Account/SearchController.php @@ -32,6 +32,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountSearchHelper; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * SearchController + */ final class SearchController extends AccountControllerBase { use JsonTrait; @@ -62,9 +65,7 @@ final class SearchController extends AccountControllerBase $this->eventDispatcher->notifyEvent('show.account.search', new Event($this)); - return $this->returnJsonResponseData([ - 'html' => $this->render(), - ]); + return $this->returnJsonResponseData(['html' => $this->render()]); } catch (Exception $e) { processException($e); diff --git a/app/modules/web/Controllers/Account/ViewController.php b/app/modules/web/Controllers/Account/ViewController.php index 2a18547a..c7469c49 100644 --- a/app/modules/web/Controllers/Account/ViewController.php +++ b/app/modules/web/Controllers/Account/ViewController.php @@ -27,35 +27,14 @@ namespace SP\Modules\Web\Controllers\Account; use Exception; use SP\Core\Acl\ActionsInterface; -use SP\Core\Application; use SP\Core\Events\Event; -use SP\Core\UI\ThemeIcons; -use SP\Domain\Account\AccountServiceInterface; -use SP\Modules\Web\Controllers\Helpers\Account\AccountHelper; -use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; -final class ViewController extends AccountControllerBase +/** + * ViewController + */ +final class ViewController extends AccountViewBase { - private \SP\Domain\Account\AccountServiceInterface $accountService; - private AccountHelper $accountHelper; - private ThemeIcons $icons; - - public function __construct( - Application $application, - WebControllerHelper $webControllerHelper, - AccountServiceInterface $accountService, - AccountHelper $accountHelper - ) { - parent::__construct( - $application, - $webControllerHelper - ); - - $this->accountService = $accountService; - $this->accountHelper = $accountHelper; - $this->icons = $this->theme->getIcons(); - } /** * View action diff --git a/app/modules/web/Controllers/Account/ViewHistoryController.php b/app/modules/web/Controllers/Account/ViewHistoryController.php index f1411817..d410a2f4 100644 --- a/app/modules/web/Controllers/Account/ViewHistoryController.php +++ b/app/modules/web/Controllers/Account/ViewHistoryController.php @@ -24,24 +24,27 @@ namespace SP\Modules\Web\Controllers\Account; - use Exception; use SP\Core\Acl\ActionsInterface; use SP\Core\Application; use SP\Core\Events\Event; +use SP\Domain\Account\AccountHistoryServiceInterface; use SP\Modules\Web\Controllers\Helpers\Account\AccountHistoryHelper; use SP\Mvc\Controller\WebControllerHelper; use SP\Util\ErrorUtil; +/** + * ViewHistoryController + */ final class ViewHistoryController extends AccountControllerBase { - private \SP\Domain\Account\AccountHistoryServiceInterface $accountHistoryService; - private AccountHistoryHelper $accountHistoryHelper; + private AccountHistoryServiceInterface $accountHistoryService; + private AccountHistoryHelper $accountHistoryHelper; public function __construct( Application $application, WebControllerHelper $webControllerHelper, - \SP\Domain\Account\AccountHistoryServiceInterface $accountHistoryService, + AccountHistoryServiceInterface $accountHistoryService, AccountHistoryHelper $accountHistoryHelper ) { parent::__construct( diff --git a/app/modules/web/Controllers/Account/ViewLinkController.php b/app/modules/web/Controllers/Account/ViewLinkController.php index b6b0f40d..42eb43da 100644 --- a/app/modules/web/Controllers/Account/ViewLinkController.php +++ b/app/modules/web/Controllers/Account/ViewLinkController.php @@ -35,6 +35,7 @@ use SP\Core\Events\Event; use SP\Core\Events\EventMessage; use SP\Core\UI\ThemeIcons; use SP\DataModel\AccountExtData; +use SP\Domain\Account\AccountServiceInterface; use SP\Domain\Account\PublicLinkServiceInterface; use SP\Domain\Account\Services\PublicLinkService; use SP\Http\Uri; @@ -43,17 +44,20 @@ use SP\Util\ErrorUtil; use SP\Util\ImageUtil; use SP\Util\Util; +/** + * Class ViewLinkController + */ final class ViewLinkController extends AccountControllerBase { - private \SP\Domain\Account\AccountServiceInterface $accountService; - private ThemeIcons $icons; - private PublicLinkService $publicLinkService; - private ImageUtil $imageUtil; + private AccountServiceInterface $accountService; + private ThemeIcons $icons; + private PublicLinkService $publicLinkService; + private ImageUtil $imageUtil; public function __construct( Application $application, WebControllerHelper $webControllerHelper, - \SP\Domain\Account\AccountServiceInterface $accountService, + AccountServiceInterface $accountService, PublicLinkServiceInterface $publicLinkService, ImageUtil $imageUtil ) { diff --git a/app/modules/web/Controllers/Account/ViewPassController.php b/app/modules/web/Controllers/Account/ViewPassController.php index c2a531e9..171ab986 100644 --- a/app/modules/web/Controllers/Account/ViewPassController.php +++ b/app/modules/web/Controllers/Account/ViewPassController.php @@ -37,6 +37,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class ViewPassController + */ final class ViewPassController extends AccountControllerBase { use JsonTrait; diff --git a/app/modules/web/Controllers/Account/ViewPassHistoryController.php b/app/modules/web/Controllers/Account/ViewPassHistoryController.php index d361821f..7a6754bb 100644 --- a/app/modules/web/Controllers/Account/ViewPassHistoryController.php +++ b/app/modules/web/Controllers/Account/ViewPassHistoryController.php @@ -37,6 +37,9 @@ use SP\Modules\Web\Controllers\Helpers\Account\AccountPasswordHelper; use SP\Modules\Web\Controllers\Traits\JsonTrait; use SP\Mvc\Controller\WebControllerHelper; +/** + * Class ViewPassHistoryController + */ final class ViewPassHistoryController extends AccountControllerBase { use JsonTrait;