TinyBlob::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3.1406

Importance

Changes 0
Metric Value
cc 3
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 3
cts 4
cp 0.75
crap 3.1406
rs 10
c 0
b 0
f 0
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
 * - TinyBlob
10
 * - TinyText
11
 */
12
class TinyBlob extends Strlen
13
{
14
    /**
15
     * @param int $len Acceptable string length.
16
     */
17 6
    public function __construct(int $len)
18
    {
19 6
        if ($len < 0 || $len > (pow(2, 8))) {
20 6
            throw new \InvalidArgumentException('TinyBlob & Text can only accept lengths between 0 - 2^8');
21
        }
22
23
        parent::__construct($len);
24
    }
25
}
26