Code Duplication    Length = 17-17 lines in 2 locations

src/Controllers/Web.php 1 location

@@ 62-78 (lines=17) @@
59
     * @param $obj
60
     * @return array
61
     */
62
    protected function objectToArray($obj)
63
    {
64
        if (is_object($obj)) {
65
            $obj = (array)$obj;
66
        }
67
68
        if (is_array($obj)) {
69
            $new = array();
70
            foreach ($obj as $key => $val) {
71
                $new[$key] = $this->objectToArray($val);
72
            }
73
        } else {
74
            $new = $obj;
75
        }
76
77
        return $new;
78
    }
79
}
80

src/Controllers/Bar.php 1 location

@@ 48-64 (lines=17) @@
45
     * @param $obj
46
     * @return array
47
     */
48
    protected function objectToArray($obj)
49
    {
50
        if (is_object($obj)) {
51
            $obj = (array)$obj;
52
        }
53
54
        if (is_array($obj)) {
55
            $new = array();
56
            foreach ($obj as $key => $val) {
57
                $new[$key] = $this->objectToArray($val);
58
            }
59
        } else {
60
            $new = $obj;
61
        }
62
63
        return $new;
64
    }
65
}
66