summaryrefslogtreecommitdiffstats
path: root/src/Plugin/ForbiddenNullValuesValidator.php
blob: ce1045ca8d5ba86ecbdee6f543b6bb121c6c0434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* This file is part of the League.csv library
*
* @license http://opensource.org/licenses/MIT
* @link https://github.com/thephpleague/csv/
* @version 8.0.0
* @package League.csv
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace League\Csv\Plugin;

/**
 *  A class to validate null value handling on data insertion into a CSV
 *
 * @package League.csv
 * @since  7.0.0
 *
 */
class ForbiddenNullValuesValidator
{
    /**
     * Is the submitted row valid
     *
     * @param array $row
     *
     * @return bool
     */
    public function __invoke(array $row)
    {
        $res = array_filter($row, function ($value) {
            return is_null($value);
        });

        return !$res;
    }
}