ArrayObject   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
dl 0
loc 22
c 1
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A toArray() 0 10 3
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
}