JsonSerializableTrait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 10 2
1
<?php
2
3
namespace BrainExe\Core\Traits;
4
5
/**
6
 * @api
7
 */
8
trait JsonSerializableTrait
9
{
10
    /**
11
     * @return array
12
     */
13
    public function jsonSerialize() : array
14
    {
15
        $data = [];
16
17
        foreach ($this as $key => $value) {
0 ignored issues
show
Bug introduced by
The expression $this of type this<BrainExe\Core\Traits\JsonSerializableTrait> is not traversable.
Loading history...
18
            $data[$key] = $value;
19
        }
20
21
        return $data;
22
    }
23
}
24