SkipNullValuesFormatter   A
last analyzed

↳ Parent: Project

Coupling/Cohesion

Components 0
Dependencies 0

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 16
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 6 1
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 SkipNullValuesFormatter
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