Completed
Push — master ( 8aa7dc...60303f )
by Marcus
02:14
created

Enum::__construct()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3.072

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 2
nop 1
dl 0
loc 9
ccs 4
cts 5
cp 0.8
crap 3.072
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\InValues;
6
7
/**
8
 * Validates that data can be inserted into one of the following column types:
9
 * - Enum
10
 */
11
class Enum extends InValues
12
{
13
    /**
14
     * @param array $array Array of valid values.
15
     */
16 6
    public function __construct(array $array)
17
    {
18 6
        $arrayCount = count($array);
19
20 6
        if ($arrayCount <= 0 || $arrayCount > 65535) {
21 6
            throw new \InvalidArgumentException('Enum must have 1 value and no more than 65,535 values');
22
        }
23
24
        parent::__construct($array);
25
    }
26
}
27