mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2024-12-04 23:17:19 +01:00
Refactored code
This commit is contained in:
parent
504f1e14ee
commit
88ce800478
@ -8,6 +8,7 @@ use Infinito\Domain\ActionManagement\ActionHandlerServiceInterface;
|
||||
use Infinito\Entity\Source\Primitive\Text\TextSource;
|
||||
use Infinito\Domain\DataAccessManagement\ActionsResultsDAOServiceInterface;
|
||||
use Infinito\Domain\ParameterManagement\ValidGetParameterServiceInterface;
|
||||
use Symfony\Component\Finder\Exception\AccessDeniedException;
|
||||
|
||||
/**
|
||||
* @author kevinfrantz
|
||||
@ -54,6 +55,26 @@ 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}
|
||||
@ -62,17 +83,8 @@ final class ProcessService implements ProcessServiceInterface
|
||||
*/
|
||||
public function process()
|
||||
{
|
||||
$result = null;
|
||||
$result = $this->getResult();
|
||||
$actionType = $this->requestedActionService->getActionType();
|
||||
if ($this->requestedActionService->hasRequestedEntity() && $this->requestedActionService->getRequestedEntity()->hasIdentity()) {
|
||||
// READ UPDATE DELETE EXECUTE
|
||||
if ($this->secureRequestedRightCheckerService->check($this->requestedActionService)) {
|
||||
$result = $this->actionHandlerService->handle();
|
||||
}
|
||||
} else {
|
||||
// CREATE
|
||||
$this->requestedActionService->getRequestedEntity()->setClass(TextSource::class);
|
||||
}
|
||||
$this->actionsResultsDAOService->setData($actionType, $result);
|
||||
|
||||
return $this->actionsResultsDAOService;
|
||||
|
Loading…
Reference in New Issue
Block a user