Completed
Push — master ( be6e2d...e7f403 )
by ignace nyamagana
03:58 queued 02:21
created

SkipNullValues::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 3
cts 3
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 remove null value from data before 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 SkipNullValues
26
{
27
    /**
28
     * remove null value form the submitted array
29
     *
30
     * @param array $record
31
     *
32
     * @return array
33
     */
34
    public function __invoke(array $record): array
35
    {
36 2
        return array_filter($record, function ($value): bool {
37 2
            return null !== $value;
38 2
        });
39
    }
40
}
41