Passed
Push — master ( 93c0a5...b2d39c )
by Stephen
54s queued 11s
created

ApplyMap::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Monooso\Apposite\Rules;
4
5
use Illuminate\Contracts\Validation\Rule;
6
7
class ApplyMap extends Apply implements Rule
8
{
9
    /**
10
     * Initialise the custom rule
11
     *
12
     * @param string $key
13
     * @param array  $map
14
     */
15 2
    public function __construct(string $key, array $map)
16
    {
17 2
        (array_key_exists($key, $map))
18 1
            ? parent::__construct(true, $map[$key])
19 1
            : parent::__construct(false, []);
20 2
    }
21
}
22