Collection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getItems() 0 3 1
A toArray() 0 12 3
1
<?php
2
3
namespace Salah3id\Domains;
4
5
use Illuminate\Contracts\Support\Arrayable;
6
use Illuminate\Support\Collection as BaseCollection;
7
8
class Collection extends BaseCollection
9
{
10
    /**
11
     * Get items collections.
12
     *
13
     * @return array
14
     */
15
    public function getItems()
16
    {
17
        return $this->items;
18
    }
19
20
    /**
21
     * Get the collection of items as a plain array.
22
     *
23
     * @return array
24
     */
25
    public function toArray()
26
    {
27
        return array_map(function ($value) {
28
            if ($value instanceof Domain) {
29
                $attributes = $value->json()->getAttributes();
30
                $attributes["path"] = $value->getPath();
31
32
                return $attributes;
33
            }
34
35
            return $value instanceof Arrayable ? $value->toArray() : $value;
36
        }, $this->items);
37
    }
38
}
39