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

SerializableTrait   A

Complexity

Total Complexity 31

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 31
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 13
ccs 0
cts 5
cp 0
rs 9.8

1 Method

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 10 2
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