ArraySchema   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 6

3 Methods

Rating   Name   Duplication   Size   Complexity  
A phpType() 0 7 2
A hasItems() 0 4 2
A items() 0 3 2
1
<?php
2
3
namespace RoundingWell\Schematic\Schema;
4
5
use RoundingWell\Schematic\Schema;
6
7
class ArraySchema extends Schema
8
{
9
    public function phpType()
10
    {
11
        if ($this->hasItems()) {
12
            return $this->items()->phpType() . '[]';
13
        }
14
15
        return 'array';
16
    }
17
18
    public function hasItems()
19
    {
20
        return isset($this->schema->items)
21
            && isset($this->schema->items->type);
22
    }
23
24
    public function items()
25
    {
26
        return $this->hasItems() ? Schema::make($this->schema->items) : null;
27
    }
28
}
29