ValidateParams::validateParams()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 3
eloc 3
nc 2
nop 2
1
<?php
2
3
namespace JincorTech\AuthClient\Traits;
4
5
use InvalidArgumentException;
6
7
/**
8
 * Trait ValidateParams.
9
 */
10
trait ValidateParams
11
{
12
    /**
13
     * @param array $params
14
     * @param array $requiredKeys
15
     */
16
    protected function validateParams(array $params, array $requiredKeys)
17
    {
18
        foreach ($requiredKeys as $key) {
19
            if (! isset($params[$key])) {
20
                throw new InvalidArgumentException(sprintf('Required key: %s is not specified', $key));
21
            }
22
        }
23
    }
24
}
25