Completed
Push — master ( f98365...7d52cd )
by Saurabh
10:18
created

InputChecker   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 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 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateHasKeys() 0 8 2
1
<?php
2
3
namespace Sausin\Signere\Concerns;
4
5
use BadMethodCallException;
6
7
trait InputChecker
8
{
9
    /**
10
     * Check that the input has needed keys.
11
     *
12
     * @param  array  &$input
13
     * @param  array  &$keys
14
     * @return \BadMethodCallException|void
15
     */
16 12
    protected function validateHasKeys(array &$input, array &$keys)
17
    {
18 12
        if (! array_has_all_keys($input, $keys)) {
19 5
            throw new BadMethodCallException(
20 5
                'Missing fields in input array. Need '.implode(', ', $keys)
21
            );
22
        }
23 12
    }
24
}
25