TypeArray   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A cast() 0 3 2
A __construct() 0 3 1
1
<?php
2
3
namespace Mvkasatkin\typecast\type;
4
5
class TypeArray extends Type
6
{
7
8
    /**
9
     * @param array $default
10
     */
11
    public function __construct($default = [])
12
    {
13
        parent::__construct($default);
14
    }
15
16
    /**
17
     * @param $value
18
     *
19
     * @return array|null
20
     */
21
    public function cast($value)
22
    {
23
        return $value === null ? $this->default : (array)$value;
24
    }
25
}
26