mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-11-04 11:17:58 +00:00 
			
		
		
		
	Refactored code
This commit is contained in:
		@@ -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;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user