src/Service/JobValidator/PropertyValidator/IsArray.php 1 location
|
@@ 18-34 (lines=17) @@
|
| 15 |
|
use Chapi\Entity\JobEntityInterface; |
| 16 |
|
use Chapi\Service\JobValidator\PropertyValidatorInterface; |
| 17 |
|
|
| 18 |
|
class IsArray extends AbstractPropertyValidator implements PropertyValidatorInterface |
| 19 |
|
{ |
| 20 |
|
const DIC_NAME = 'IsArrayValidator'; |
| 21 |
|
const MESSAGE_TEMPLATE = '"%s" is not an array'; |
| 22 |
|
|
| 23 |
|
/** |
| 24 |
|
* @inheritDoc |
| 25 |
|
*/ |
| 26 |
|
public function isValid($property, JobEntityInterface $jobEntity) |
| 27 |
|
{ |
| 28 |
|
return $this->returnIsValidHelper( |
| 29 |
|
is_array($jobEntity->{$property}), |
| 30 |
|
$property, |
| 31 |
|
self::MESSAGE_TEMPLATE |
| 32 |
|
); |
| 33 |
|
} |
| 34 |
|
} |
| 35 |
|
|
src/Service/JobValidator/PropertyValidator/IsBoolean.php 1 location
|
@@ 17-33 (lines=17) @@
|
| 14 |
|
use Chapi\Entity\JobEntityInterface; |
| 15 |
|
use Chapi\Service\JobValidator\PropertyValidatorInterface; |
| 16 |
|
|
| 17 |
|
class IsBoolean extends AbstractPropertyValidator implements PropertyValidatorInterface |
| 18 |
|
{ |
| 19 |
|
const DIC_NAME = 'BooleanValidator'; |
| 20 |
|
const MESSAGE_TEMPLATE = '"%s" is not boolean'; |
| 21 |
|
|
| 22 |
|
/** |
| 23 |
|
* @inheritDoc |
| 24 |
|
*/ |
| 25 |
|
public function isValid($property, JobEntityInterface $jobEntity) |
| 26 |
|
{ |
| 27 |
|
return $this->returnIsValidHelper( |
| 28 |
|
is_bool($jobEntity->{$property}), |
| 29 |
|
$property, |
| 30 |
|
self::MESSAGE_TEMPLATE |
| 31 |
|
); |
| 32 |
|
} |
| 33 |
|
} |
| 34 |
|
|
src/Service/JobValidator/PropertyValidator/NotEmpty.php 1 location
|
@@ 16-32 (lines=17) @@
|
| 13 |
|
use Chapi\Entity\JobEntityInterface; |
| 14 |
|
use Chapi\Service\JobValidator\PropertyValidatorInterface; |
| 15 |
|
|
| 16 |
|
class NotEmpty extends AbstractPropertyValidator implements PropertyValidatorInterface |
| 17 |
|
{ |
| 18 |
|
const DIC_NAME = 'NotEmptyValidator'; |
| 19 |
|
const MESSAGE_TEMPLATE = '"%s" is empty'; |
| 20 |
|
|
| 21 |
|
/** |
| 22 |
|
* @inheritDoc |
| 23 |
|
*/ |
| 24 |
|
public function isValid($property, JobEntityInterface $jobEntity) |
| 25 |
|
{ |
| 26 |
|
return $this->returnIsValidHelper( |
| 27 |
|
!empty($jobEntity->{$property}), |
| 28 |
|
$property, |
| 29 |
|
self::MESSAGE_TEMPLATE |
| 30 |
|
); |
| 31 |
|
} |
| 32 |
|
} |
| 33 |
|
|
src/Service/JobValidator/PropertyValidator/Retries.php 1 location
|
@@ 16-32 (lines=17) @@
|
| 13 |
|
use Chapi\Entity\JobEntityInterface; |
| 14 |
|
use Chapi\Service\JobValidator\PropertyValidatorInterface; |
| 15 |
|
|
| 16 |
|
class Retries extends AbstractPropertyValidator implements PropertyValidatorInterface |
| 17 |
|
{ |
| 18 |
|
const DIC_NAME = 'RetriesValidator'; |
| 19 |
|
const MESSAGE_TEMPLATE = '"%s" is not numeric or greater than or equal 0'; |
| 20 |
|
|
| 21 |
|
/** |
| 22 |
|
* @inheritDoc |
| 23 |
|
*/ |
| 24 |
|
public function isValid($property, JobEntityInterface $jobEntity) |
| 25 |
|
{ |
| 26 |
|
return $this->returnIsValidHelper( |
| 27 |
|
(is_numeric($jobEntity->{$property}) && $jobEntity->{$property} >= 0), |
| 28 |
|
$property, |
| 29 |
|
self::MESSAGE_TEMPLATE |
| 30 |
|
); |
| 31 |
|
} |
| 32 |
|
} |
| 33 |
|
|