PhpArray   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 36
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 3 1
A newData() 0 3 1
A fromArray() 0 3 1
A __toString() 0 3 1
1
<?php
2
3
namespace Ghc\Rosetta\Messages;
4
5
class PhpArray extends Message
6
{
7
    /**
8
     * @return array
9
     */
10
    public function newData()
11
    {
12
        return [];
13
    }
14
15
    /**
16
     * Get the instance as an array.
17
     *
18
     * @return array
19
     */
20
    public function toArray()
21
    {
22
        return $this->getData();
23
    }
24
25
    /**
26
     * @param array $data
27
     *
28
     * @return self
29
     */
30
    public function fromArray($data)
31
    {
32
        return $this->setData($data);
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function __toString()
39
    {
40
        return serialize($this->toArray());
41
    }
42
}
43