| @@ 27-90 (lines=64) @@ | ||
| 24 | /** |
|
| 25 | * Class DeleteAction. |
|
| 26 | */ |
|
| 27 | class DeleteAction extends AbstractMiddlewareAction |
|
| 28 | { |
|
| 29 | /** @var ConfigurationInterface */ |
|
| 30 | private $configuration; |
|
| 31 | /** @var AuthInterface */ |
|
| 32 | private $authAdapter; |
|
| 33 | /** @var EnvironmentInterface */ |
|
| 34 | private $environmentManager; |
|
| 35 | /** @var ApplicationStorage */ |
|
| 36 | private $applicationStorage; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * DeleteAction constructor. |
|
| 40 | * |
|
| 41 | * @param ConfigurationInterface $configuration |
|
| 42 | * @param AuthInterface $authAdapter |
|
| 43 | * @param EnvironmentInterface $environmentManager |
|
| 44 | * @parem ApplicationStorage $applicationStorage |
|
| 45 | */ |
|
| 46 | public function __construct( |
|
| 47 | ConfigurationInterface $configuration, |
|
| 48 | AuthInterface $authAdapter, |
|
| 49 | EnvironmentInterface $environmentManager, |
|
| 50 | ApplicationStorage $applicationStorage |
|
| 51 | ) { |
|
| 52 | $this->configuration = $configuration; |
|
| 53 | $this->authAdapter = $authAdapter; |
|
| 54 | $this->environmentManager = $environmentManager; |
|
| 55 | $this->applicationStorage = $applicationStorage; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Gets template map name or template file path. |
|
| 60 | * |
|
| 61 | * @return string |
|
| 62 | */ |
|
| 63 | public function getTemplateName() : string |
|
| 64 | { |
|
| 65 | return 'admin-applications-delete'; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Gets template data. |
|
| 70 | * |
|
| 71 | * @return array |
|
| 72 | */ |
|
| 73 | public function getTemplateData() : array |
|
| 74 | { |
|
| 75 | $params = $this->getRoutingParameters(); |
|
| 76 | $applicationName = $params['name'] ?? ''; |
|
| 77 | $applicationEntity = $this->applicationStorage->getApplicationByName($applicationName); |
|
| 78 | ||
| 79 | if (!$applicationEntity instanceof ApplicationEntity) { |
|
| 80 | throw new InvalidArgumentException( |
|
| 81 | sprintf('%s is not a valid application name', $applicationName), |
|
| 82 | 404 |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | return [ |
|
| 87 | 'application' => $applicationEntity |
|
| 88 | ]; |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||
| @@ 27-90 (lines=64) @@ | ||
| 24 | /** |
|
| 25 | * Class PreferencesAction |
|
| 26 | */ |
|
| 27 | class PreferencesAction extends AbstractMiddlewareAction |
|
| 28 | { |
|
| 29 | /** @var ConfigurationInterface */ |
|
| 30 | private $configuration; |
|
| 31 | /** @var AuthInterface */ |
|
| 32 | private $authAdapter; |
|
| 33 | /** @var EnvironmentInterface */ |
|
| 34 | private $environmentManager; |
|
| 35 | /** @var ApplicationStorage */ |
|
| 36 | private $applicationStorage; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * PreferencesAction constructor. |
|
| 40 | * |
|
| 41 | * @param ConfigurationInterface $configuration |
|
| 42 | * @param AuthInterface $authAdapter |
|
| 43 | * @param EnvironmentInterface $environmentManager |
|
| 44 | * @parem ApplicationStorage $applicationStorage |
|
| 45 | */ |
|
| 46 | public function __construct( |
|
| 47 | ConfigurationInterface $configuration, |
|
| 48 | AuthInterface $authAdapter, |
|
| 49 | EnvironmentInterface $environmentManager, |
|
| 50 | ApplicationStorage $applicationStorage |
|
| 51 | ) { |
|
| 52 | $this->configuration = $configuration; |
|
| 53 | $this->authAdapter = $authAdapter; |
|
| 54 | $this->environmentManager = $environmentManager; |
|
| 55 | $this->applicationStorage = $applicationStorage; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Gets template map name or template file path. |
|
| 60 | * |
|
| 61 | * @return string |
|
| 62 | */ |
|
| 63 | public function getTemplateName() : string |
|
| 64 | { |
|
| 65 | return 'admin-applications-preferences'; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Gets template data. |
|
| 70 | * |
|
| 71 | * @return array |
|
| 72 | */ |
|
| 73 | public function getTemplateData() : array |
|
| 74 | { |
|
| 75 | $params = $this->getRoutingParameters(); |
|
| 76 | $applicationName = $params['name'] ?? ''; |
|
| 77 | $applicationEntity = $this->applicationStorage->getApplicationByName($applicationName); |
|
| 78 | ||
| 79 | if (!$applicationEntity instanceof ApplicationEntity) { |
|
| 80 | throw new InvalidArgumentException( |
|
| 81 | sprintf('%s is not a valid application name', $applicationName), |
|
| 82 | 404 |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | return [ |
|
| 87 | 'application' => $applicationEntity |
|
| 88 | ]; |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||
| @@ 27-90 (lines=64) @@ | ||
| 24 | /** |
|
| 25 | * Class SaveAction. |
|
| 26 | */ |
|
| 27 | class SaveAction extends AbstractMiddlewareAction |
|
| 28 | { |
|
| 29 | /** @var ConfigurationInterface */ |
|
| 30 | private $configuration; |
|
| 31 | /** @var AuthInterface */ |
|
| 32 | private $authAdapter; |
|
| 33 | /** @var EnvironmentInterface */ |
|
| 34 | private $environmentManager; |
|
| 35 | /** @var ApplicationStorage */ |
|
| 36 | private $applicationStorage; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * SaveAction constructor. |
|
| 40 | * |
|
| 41 | * @param ConfigurationInterface $configuration |
|
| 42 | * @param AuthInterface $authAdapter |
|
| 43 | * @param EnvironmentInterface $environmentManager |
|
| 44 | * @parem ApplicationStorage $applicationStorage |
|
| 45 | */ |
|
| 46 | public function __construct( |
|
| 47 | ConfigurationInterface $configuration, |
|
| 48 | AuthInterface $authAdapter, |
|
| 49 | EnvironmentInterface $environmentManager, |
|
| 50 | ApplicationStorage $applicationStorage |
|
| 51 | ) { |
|
| 52 | $this->configuration = $configuration; |
|
| 53 | $this->authAdapter = $authAdapter; |
|
| 54 | $this->environmentManager = $environmentManager; |
|
| 55 | $this->applicationStorage = $applicationStorage; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Gets template map name or template file path. |
|
| 60 | * |
|
| 61 | * @return string |
|
| 62 | */ |
|
| 63 | public function getTemplateName() : string |
|
| 64 | { |
|
| 65 | return ''; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Gets template data. |
|
| 70 | * |
|
| 71 | * @return array |
|
| 72 | */ |
|
| 73 | public function getTemplateData() : array |
|
| 74 | { |
|
| 75 | $params = $this->getAllParameters(); |
|
| 76 | $applicationName = $params['ROUTE']['name'] ?? ''; |
|
| 77 | $applicationEntity = $this->applicationStorage->getApplicationByName($applicationName); |
|
| 78 | ||
| 79 | if (!$applicationEntity instanceof ApplicationEntity) { |
|
| 80 | throw new InvalidArgumentException( |
|
| 81 | sprintf('%s is not a valid application name', $applicationName), |
|
| 82 | 404 |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | return [ |
|
| 87 | 'application' => $applicationEntity |
|
| 88 | ]; |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||
| @@ 27-90 (lines=64) @@ | ||
| 24 | /** |
|
| 25 | * Class ViewAction. |
|
| 26 | */ |
|
| 27 | class ViewAction extends AbstractMiddlewareAction |
|
| 28 | { |
|
| 29 | /** @var ConfigurationInterface */ |
|
| 30 | private $configuration; |
|
| 31 | /** @var AuthInterface */ |
|
| 32 | private $authAdapter; |
|
| 33 | /** @var EnvironmentInterface */ |
|
| 34 | private $environmentManager; |
|
| 35 | /** @var ApplicationStorage */ |
|
| 36 | private $applicationStorage; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * ViewAction constructor. |
|
| 40 | * |
|
| 41 | * @param ConfigurationInterface $configuration |
|
| 42 | * @param AuthInterface $authAdapter |
|
| 43 | * @param EnvironmentInterface $environmentManager |
|
| 44 | * @parem ApplicationStorage $applicationStorage |
|
| 45 | */ |
|
| 46 | public function __construct( |
|
| 47 | ConfigurationInterface $configuration, |
|
| 48 | AuthInterface $authAdapter, |
|
| 49 | EnvironmentInterface $environmentManager, |
|
| 50 | ApplicationStorage $applicationStorage |
|
| 51 | ) { |
|
| 52 | $this->configuration = $configuration; |
|
| 53 | $this->authAdapter = $authAdapter; |
|
| 54 | $this->environmentManager = $environmentManager; |
|
| 55 | $this->applicationStorage = $applicationStorage; |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Gets template map name or template file path. |
|
| 60 | * |
|
| 61 | * @return string |
|
| 62 | */ |
|
| 63 | public function getTemplateName() : string |
|
| 64 | { |
|
| 65 | return 'admin-applications-view'; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * Gets template data. |
|
| 70 | * |
|
| 71 | * @return array |
|
| 72 | */ |
|
| 73 | public function getTemplateData() : array |
|
| 74 | { |
|
| 75 | $params = $this->getRoutingParameters(); |
|
| 76 | $applicationName = $params['name'] ?? ''; |
|
| 77 | $applicationEntity = $this->applicationStorage->getApplicationByName($applicationName); |
|
| 78 | ||
| 79 | if (!$applicationEntity instanceof ApplicationEntity) { |
|
| 80 | throw new InvalidArgumentException( |
|
| 81 | sprintf('%s is not a valid application name', $applicationName), |
|
| 82 | 404 |
|
| 83 | ); |
|
| 84 | } |
|
| 85 | ||
| 86 | return [ |
|
| 87 | 'application' => $applicationEntity |
|
| 88 | ]; |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||