summaryrefslogtreecommitdiffstats
path: root/src/Plugin/SkipNullValuesFormatter.php
blob: a738982a6fb2e0f17dc4246437628e423f9ebbd8 (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
<?php
/**
* This file is part of the League.csv library
*
* @license http://opensource.org/licenses/MIT
* @link https://github.com/thephpleague/csv/
* @version 8.1.1
* @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 remove null value from data before insertion into a CSV
 *
 * @package League.csv
 * @since  7.0.0
 *
 */
class SkipNullValuesFormatter
{
    /**
     * remove null value form the submitted array
     *
     * @param array $row
     *
     * @return array
     */
    public function __invoke(array $row)
    {
        return array_filter($row, function ($value) {
            return null !== $value;
        });
    }
}