Completed
Push — master ( b22df9...4eff91 )
by Marcus
02:10
created

Char::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3.576

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 3
cts 5
cp 0.6
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 1
crap 3.576
1
<?php
2
3
namespace Mbright\Validation\Rule\Validate\MySql;
4
5
use Mbright\Validation\Rule\Validate\Strlen;
6
7
/**
8
 * Validates that data can be inserted into one of the following column types:
9
 * - Char
10
 * - Binary
11
 */
12
class Char extends Strlen
13
{
14 6
    public function __construct(int $len)
15
    {
16 6
        if ($len < 0 || $len > 255) {
17 6
            throw new \InvalidArgumentException('Char can only accepts lengths between 0 and 255');
18
        }
19
20
        parent::__construct($len);
21
    }
22
}
23