Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
IsNull
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
1 / 1
 evaluate
100.00% covered (success)
100.00%
8 / 8
100.00% covered (success)
100.00%
1 / 1
4
1<?php
2/**
3 * Pop PHP Framework (http://www.popphp.org/)
4 *
5 * @link       https://github.com/popphp/popphp-framework
6 * @author     Nick Sagona, III <dev@noladev.com>
7 * @copyright  Copyright (c) 2009-2025 NOLA Interactive, LLC.
8 * @license    http://www.popphp.org/license     New BSD License
9 */
10
11/**
12 * @namespace
13 */
14namespace Pop\Validator;
15
16/**
17 * Is null validator class
18 *
19 * @category   Pop
20 * @package    Pop\Validator
21 * @author     Nick Sagona, III <dev@noladev.com>
22 * @copyright  Copyright (c) 2009-2025 NOLA Interactive, LLC.
23 * @license    http://www.popphp.org/license     New BSD License
24 * @version    4.5.0
25 */
26class IsNull extends AbstractValidator
27{
28
29    /**
30     * Method to evaluate the validator
31     *
32     * @param  mixed $input
33     * @return bool
34     */
35    public function evaluate(mixed $input = null): bool
36    {
37        $args = func_get_args();
38
39        // Set the input, if passed
40        if ($input !== null) {
41            $this->input = $input;
42            // Else, check if the input arg was passed as null
43        } else if (count($args) > 0) {
44            $this->input = $args[0];
45        }
46
47        // Set the default message
48        if ($this->message === null) {
49            $this->message = 'The value must be null.';
50        }
51
52        return ($this->input === null);
53    }
54
55}