Completed
Push — master ( 944a1d...98f153 )
by Oleg
01:36
created

SimpleBag   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
ccs 4
cts 6
cp 0.6667
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A jsonSerialize() 0 4 1
A toArray() 0 4 1
A __toString() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace SlayerBirden\DataFlow\Data;
5
6
use SlayerBirden\DataFlow\DataBagInterface;
7
8
class SimpleBag extends \ArrayObject implements DataBagInterface
9
{
10
    /**
11
     * @inheritdoc
12
     */
13 3
    public function jsonSerialize()
14
    {
15 3
        return $this->getArrayCopy();
16
    }
17
18
    /**
19
     * @inheritdoc
20
     */
21 5
    public function toArray(): array
22
    {
23 5
        return $this->getArrayCopy();
24
    }
25
26
    /**
27
     * Return string representation of the bag.
28
     *
29
     * @return string
30
     */
31
    public function __toString(): string
32
    {
33
        return json_encode($this);
34
    }
35
}
36