Completed
Push — develop ( 4758ca...918a98 )
by Abdelrahman
02:04
created

DataProcessor   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B escapeRow() 0 16 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Foundation\Processors;
6
7
use Yajra\DataTables\Processors\DataProcessor as BaseDataProcessor;
8
9
class DataProcessor extends BaseDataProcessor
10
{
11
    /**
12
     * Escape all values of row.
13
     *
14
     * @param array $row
15
     * @return array
16
     */
17
    protected function escapeRow(array $row)
18
    {
19
        $arrayDot = array_filter(array_dot($row));
20
21
        foreach ($arrayDot as $key => $value) {
22
            if (! in_array($key, $this->rawColumns) && is_string($value)) {
23
                $arrayDot[$key] = e($value);
24
            }
25
        }
26
27
        foreach ($arrayDot as $key => $value) {
28
            array_set($row, $key, $value);
29
        }
30
31
        return $row;
32
    }
33
}
34