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

Enum   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 14
ccs 4
cts 5
cp 0.8
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 3
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