<?php
namespace App\Security\Api\Authorization\Voter\CoreModule;
use App\Helper\Api\Entity\RequestDataContainer;
use App\Security\Api\Authorization\Voter\AbstractCrudValidationVoter;
use App\Security\Api\Authorization\VoterAttribute\CoreModule\EmployeeVoterAttribute;
use App\Validator\Api\Data\CoreModule\EmployeeDataValidator;
/**
* Validation voter.
*
* @package API
* @internal
*/
class EmployeeValidationVoter extends AbstractCrudValidationVoter
{
/**
* Constructor.
*
* @param EmployeeDataValidator $validator The standard validator.
*/
public function __construct(EmployeeDataValidator $validator)
{
// prevent false-positive php:S1185
$this->validator = $validator;
parent::__construct($validator);
}
/**
* Returns list of supported attributes.
*
* @return array
* @noinspection PhpClassConstantAccessedViaChildClassInspection
*/
protected function getSupportedAttributes(): array
{
return [
EmployeeVoterAttribute::getAttribute(EmployeeVoterAttribute::METHOD_ID_CREATE),
EmployeeVoterAttribute::getAttribute(EmployeeVoterAttribute::METHOD_ID_DELETE),
EmployeeVoterAttribute::getAttribute(EmployeeVoterAttribute::METHOD_ID_LIST),
EmployeeVoterAttribute::getAttribute(EmployeeVoterAttribute::METHOD_ID_READ),
EmployeeVoterAttribute::getAttribute(EmployeeVoterAttribute::METHOD_ID_UPDATE),
EmployeeVoterAttribute::getAttribute(EmployeeVoterAttribute::METHOD_ID_UPDATE_ACTIVE_STATUS),
EmployeeVoterAttribute::getAttribute(EmployeeVoterAttribute::METHOD_ID_MODULE_DEPENDENCY)
];
}
/**
* Validation check.
*
* @param RequestDataContainer $subject The request data object to validate.
*/
protected function moduleDependency(RequestDataContainer $subject): void
{
// no op
}
}