mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Refactored some stuff
This commit is contained in:
parent
19e1e00199
commit
77896004b6
@ -15,7 +15,7 @@ final class CreateSourceAction extends AbstractCreateAction
|
||||
/**
|
||||
* @var string default class name, when no parameter is defined
|
||||
*/
|
||||
const DEFAULT_CLASS = AbstractSource::class;
|
||||
private const DEFAULT_CLASS = AbstractSource::class;
|
||||
|
||||
/**
|
||||
* @see SourceClassInformationService
|
||||
|
@ -40,6 +40,33 @@ final class ProcessService implements ProcessServiceInterface
|
||||
*/
|
||||
private $validGetParameterService;
|
||||
|
||||
/**
|
||||
* @return bool True if the the entity exist
|
||||
*/
|
||||
private function doesEntityExist():bool{
|
||||
$requestedAction = $this->requestedActionService;
|
||||
return $requestedAction->hasRequestedEntity() && $requestedAction->getRequestedEntity()->hasIdentity();
|
||||
}
|
||||
/**
|
||||
* @return mixed|null
|
||||
*
|
||||
* @throws AccessDeniedException
|
||||
*/
|
||||
private function getResult()
|
||||
{
|
||||
if ($this->doesEntityExist()) {
|
||||
// READ UPDATE DELETE EXECUTE
|
||||
if ($this->secureRequestedRightCheckerService->check($this->requestedActionService)) {
|
||||
return $this->actionHandlerService->handle();
|
||||
}
|
||||
throw new AccessDeniedException("The user doesn't have the permission to access this page!");
|
||||
}
|
||||
// CREATE
|
||||
$this->requestedActionService->getRequestedEntity()->setClass(TextSource::class);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ActionHandlerServiceInterface $actionHandlerService
|
||||
* @param ActionsResultsDAOServiceInterface $actionTemplateDataStore
|
||||
@ -55,26 +82,6 @@ final class ProcessService implements ProcessServiceInterface
|
||||
$this->validGetParameterService = $validGetParameterService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed|null
|
||||
*
|
||||
* @throws AccessDeniedException
|
||||
*/
|
||||
private function getResult()
|
||||
{
|
||||
if ($this->requestedActionService->hasRequestedEntity() && $this->requestedActionService->getRequestedEntity()->hasIdentity()) {
|
||||
// READ UPDATE DELETE EXECUTE
|
||||
if ($this->secureRequestedRightCheckerService->check($this->requestedActionService)) {
|
||||
return $this->actionHandlerService->handle();
|
||||
}
|
||||
throw new AccessDeniedException("The user doesn't have the permission to access this page!");
|
||||
}
|
||||
// CREATE
|
||||
$this->requestedActionService->getRequestedEntity()->setClass(TextSource::class);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo Move
|
||||
* {@inheritdoc}
|
||||
|
Loading…
Reference in New Issue
Block a user