Completed
Push — master ( 0e1003...1276c7 )
by Abdelrahman
61:46 queued 59:06
created

DataProcessor   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A 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
     *
16
     * @return array
17
     */
18
    protected function escapeRow(array $row)
19
    {
20
        $arrayDot = array_filter(array_dot($row));
21
22
        foreach ($arrayDot as $key => $value) {
23
            if (! in_array($key, $this->rawColumns) && is_string($value)) {
24
                $arrayDot[$key] = e($value);
25
            }
26
        }
27
28
        foreach ($arrayDot as $key => $value) {
29
            array_set($row, $key, $value);
30
        }
31
32
        return $row;
33
    }
34
}
35