Completed
Push — master ( 5fa5de...689521 )
by Matze
03:31
created

SerializableTrait::jsonSerialize()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
ccs 0
cts 5
cp 0
rs 9.4286
cc 2
eloc 5
nc 2
nop 0
crap 6
1
<?php
2
3
namespace BrainExe\Core\Traits;
4
5
use BrainExe\Annotations\Annotations\Inject;
6
use BrainExe\Core\Util\Time;
7
8
/**
9
 * @api
10
 */
11
trait SerializableTrait
12
{
13
    function jsonSerialize()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
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\SerializableTrait> is not traversable.
Loading history...
18
            $data[$key] = $value;
19
        }
20
21
        return $data;
22
    }
23
}
24