Validate   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 8 3
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
}