Code Duplication    Length = 10-10 lines in 2 locations

src/GraphNode/GraphEdge.php 1 location

@@ 121-130 (lines=10) @@
118
     *
119
     * @return array
120
     */
121
    public function asArray()
122
    {
123
        return array_map(function ($value) {
124
            if ($value instanceof GraphNode || $value instanceof GraphEdge) {
125
                return $value->asArray();
126
            }
127
128
            return $value;
129
        }, $this->items);
130
    }
131
132
    /**
133
     * {@inheritdoc}

src/GraphNode/GraphNode.php 1 location

@@ 94-103 (lines=10) @@
91
     *
92
     * @return array
93
     */
94
    public function asArray()
95
    {
96
        return array_map(function ($value) {
97
            if ($value instanceof GraphNode || $value instanceof GraphEdge) {
98
                return $value->asArray();
99
            }
100
101
            return $value;
102
        }, $this->fields);
103
    }
104
105
    /**
106
     * Run a map over each field.