1 | <?php |
||
17 | class ChronosJobValidatorService implements JobValidatorServiceInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var ValidatorFactoryInterface |
||
21 | */ |
||
22 | private $oValidatorFactory; |
||
23 | |||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | private static $aValidationMap = [ |
||
28 | 'name' => ValidatorFactoryInterface::NAME_VALIDATOR, |
||
29 | 'command' => ValidatorFactoryInterface::COMMAND_VALIDATOR, |
||
30 | 'description' => ValidatorFactoryInterface::NOT_EMPTY_VALIDATOR, |
||
31 | 'owner' => ValidatorFactoryInterface::NOT_EMPTY_VALIDATOR, |
||
32 | 'ownerName' => ValidatorFactoryInterface::NOT_EMPTY_VALIDATOR, |
||
33 | 'epsilon' => ValidatorFactoryInterface::EPSILON_VALIDATOR, |
||
34 | 'async' => ValidatorFactoryInterface::BOOLEAN_VALIDATOR, |
||
35 | 'disabled' => ValidatorFactoryInterface::BOOLEAN_VALIDATOR, |
||
36 | 'softError' => ValidatorFactoryInterface::BOOLEAN_VALIDATOR, |
||
37 | 'highPriority' => ValidatorFactoryInterface::BOOLEAN_VALIDATOR, |
||
38 | 'schedule' => ValidatorFactoryInterface::SCHEDULE_VALIDATOR, |
||
39 | 'parents' => ValidatorFactoryInterface::ARRAY_VALIDATOR, |
||
40 | 'retries' => ValidatorFactoryInterface::RETRY_VALIDATOR, |
||
41 | 'constraints' => ValidatorFactoryInterface::CONSTRAINTS_VALIDATOR, |
||
42 | 'container' => ValidatorFactoryInterface::CONTAINER_VALIDATOR, |
||
43 | ]; |
||
44 | |||
45 | /** |
||
46 | * ChronosJobValidatorService constructor. |
||
47 | * @param ValidatorFactoryInterface $oValidatorFactory |
||
48 | */ |
||
49 | 4 | public function __construct( |
|
55 | |||
56 | /** |
||
57 | * @param JobEntityInterface $oJobEntity |
||
58 | * @return bool |
||
59 | */ |
||
60 | 2 | public function isEntityValid(JobEntityInterface $oJobEntity) |
|
72 | |||
73 | /** |
||
74 | * @param JobEntityInterface $oJobEntity |
||
75 | * @return array |
||
76 | */ |
||
77 | 2 | public function getInvalidProperties(JobEntityInterface $oJobEntity) |
|
92 | |||
93 | /** |
||
94 | * @param JobEntityInterface $oJobEntity |
||
95 | * @return array |
||
96 | */ |
||
97 | 4 | private function validateJobEntity(JobEntityInterface $oJobEntity) |
|
108 | |||
109 | /** |
||
110 | * @param int $iValidator |
||
111 | * @param string $sProperty |
||
112 | * @param JobEntityInterface $oJobEntity |
||
113 | * @return ValidationResult |
||
114 | */ |
||
115 | 4 | private function getValidationResult($iValidator, $sProperty, JobEntityInterface $oJobEntity) |
|
124 | } |