PhpArray::fromArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 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