ArrayObject::toArray()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 10
c 0
b 0
f 0
rs 10
cc 3
nc 4
nop 0
1
<?php
2
3
4
namespace carono\turbotext;
5
6
7
class ArrayObject extends \ArrayObject
8
{
9
    /**
10
     * ResponseAbstract constructor.
11
     *
12
     * @param array $input
13
     */
14
    public function __construct($input = [])
15
    {
16
        parent::__construct($input, self::ARRAY_AS_PROPS, "ArrayIterator");
17
    }
18
19
    public function toArray()
20
    {
21
        $result = [];
22
        foreach ($this as $key => $value) {
23
            $result[$key] = $value;
24
        }
25
        foreach ((new \ReflectionClass($this))->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
26
            $result[$property->name] = $this->{$property->name};
27
        }
28
        return $result;
29
    }
30
}