ArraySchema::phpType()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
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