TypeInt::cast()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Mvkasatkin\typecast\type;
4
5
class TypeInt extends Type
6
{
7
8
    /**
9
     * @param $value
10
     *
11
     * @return int|null
12
     */
13
    public function cast($value)
14
    {
15
        return $value === null ? $this->default : (int)$value;
16
    }
17
}
18