Collection   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 4
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

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