Refactored some stuff

This commit is contained in:
Kevin Frantz 2019-04-14 13:10:46 +02:00
parent 19e1e00199
commit 77896004b6
2 changed files with 28 additions and 21 deletions

View File

@ -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

View File

@ -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}