| @@ 28-47 (lines=20) @@ | ||
| 25 | /** |
|
| 26 | * @package Limoncello\Validation |
|
| 27 | */ |
|
| 28 | final class IsNotNull extends BaseOneValueComparision |
|
| 29 | { |
|
| 30 | /** |
|
| 31 | * Constructor. |
|
| 32 | */ |
|
| 33 | public function __construct() |
|
| 34 | { |
|
| 35 | parent::__construct(null, ErrorCodes::IS_NOT_NULL, Messages::IS_NOT_NULL, []); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @inheritdoc |
|
| 40 | */ |
|
| 41 | public static function compare($value, ContextInterface $context): bool |
|
| 42 | { |
|
| 43 | $result = $value !== null; |
|
| 44 | ||
| 45 | return $result; |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||
| @@ 28-47 (lines=20) @@ | ||
| 25 | /** |
|
| 26 | * @package Limoncello\Validation |
|
| 27 | */ |
|
| 28 | final class IsNull extends BaseOneValueComparision |
|
| 29 | { |
|
| 30 | /** |
|
| 31 | * Constructor. |
|
| 32 | */ |
|
| 33 | public function __construct() |
|
| 34 | { |
|
| 35 | parent::__construct(null, ErrorCodes::IS_NULL, Messages::IS_NULL, []); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @inheritdoc |
|
| 40 | */ |
|
| 41 | public static function compare($value, ContextInterface $context): bool |
|
| 42 | { |
|
| 43 | $result = $value === null; |
|
| 44 | ||
| 45 | return $result; |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||