Completed
Push — master ( be6e2d...e7f403 )
by ignace nyamagana
02:20
created

ForbiddenNullValues::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 1
dl 0
loc 8
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
* This file is part of the League.csv library
4
*
5
* @license http://opensource.org/licenses/MIT
6
* @link https://github.com/thephpleague/csv/
7
* @version 9.0.0
8
* @package League.csv
9
*
10
* For the full copyright and license information, please view the LICENSE
11
* file that was distributed with this source code.
12
*/
13
declare(strict_types=1);
14
15
namespace League\Csv\Plugin;
16
17
/**
18
 *  A class to validate null value handling on data insertion into a CSV
19
 *
20
 * @package League.csv
21
 * @since   7.0.0
22
 * @author  Ignace Nyamagana Butera <[email protected]>
23
 *
24
 */
25
class ForbiddenNullValues
26
{
27
    /**
28
     * Is the submitted record valid
29
     *
30
     * @param array $record
31
     *
32
     * @return bool
33
     */
34
    public function __invoke(array $record): bool
35
    {
36 2
        $filter = function ($value): bool {
37 2
            return null === $value;
38 1
        };
39
40 2
        return !array_filter($record, $filter);
41
    }
42
}
43