Validate::validate()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 4
nc 3
nop 2
dl 0
loc 8
ccs 5
cts 5
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Cart\Traits;
5
6
trait Validate
7
{
8
    /**
9
     * Validate input parameters
10
     *
11
     * @param array $item
12
     * @param array $require
13
     * @return bool
14
     * @internal param array $required
15
     */
16 27
    private function validate(array $item, array $require = []) : bool
17
    {
18 27
        foreach ($require as $parameter) {
19 27
            if (isset($item[$parameter]) === false) {
20 8
                return false;
21
            }
22
        }
23 19
        return true;
24
    }
25
}