<?php
namespace App\Security\Api\Authorization\Voter\SkillScreening;
use App\Helper\Api\Entity\RequestDataContainer;
use App\Security\Api\Authorization\Voter\AbstractCrudValidationVoter;
use App\Security\Api\Authorization\VoterAttribute\SkillScreening\SkillScreeningVoterAttribute;
use App\Validator\Api\Data\SkillScreening\SkillScreeningDataValidator;
/**
* Validation voter.
*
* @package API
* @internal
*/
class SkillScreeningValidationVoter extends AbstractCrudValidationVoter
{
/**
* Constructor.
*
* @param SkillScreeningDataValidator $validator The standard validator.
*/
public function __construct(SkillScreeningDataValidator $validator)
{
// prevent false-positive php:S1185
$this->validator = $validator;
parent::__construct($validator);
}
/**
* Validation check.
*
* @param RequestDataContainer $subject The request data object to validate.
*/
protected function activate(RequestDataContainer $subject): void
{
$this->validator->validateInputActivate($subject->getInput());
}
/**
* Validation check.
*
* @param RequestDataContainer $subject The request data object to validate.
*/
protected function copy(RequestDataContainer $subject): void
{
$this->validator->validateInputCopy($subject->getInput());
}
/**
* Returns list of supported attributes.
*
* @return array
* @noinspection PhpClassConstantAccessedViaChildClassInspection
*/
protected function getSupportedAttributes(): array
{
return [
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_ACTIVATE),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_COPY),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_CREATE),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_DELETE),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_LIST),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_READ),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_STATUS_UPDATE),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_UPDATE),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_UPDATE_ACTIVE_STATUS),
SkillScreeningVoterAttribute::getAttribute(SkillScreeningVoterAttribute::METHOD_ID_HOMEPAGE)
];
}
/**
* Validation check.
*
* @param RequestDataContainer $subject The request data object to validate.
*/
protected function statusUpdate(RequestDataContainer $subject): void
{
$this->validator->validateStatusUpdate($subject->getInput());
}
/**
* Validation check.
*
* @param RequestDataContainer $subject The request data object to validate.
*/
protected function homepage(RequestDataContainer $subject): void
{
}
}