| Total Complexity | 4 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | trait Authenticates |
||
| 17 | {
|
||
| 18 | /** |
||
| 19 | * Checks all the keys are present in the parameter array |
||
| 20 | * |
||
| 21 | * This can be used for validation. Create an array of all required fields, and pass them in along |
||
| 22 | * with the the parameters passed in by the user to ensure all are present |
||
| 23 | * |
||
| 24 | * @param array $keys Array of keys that should be present in the configuration |
||
| 25 | * @param array $parameters The parameters passed from the user |
||
| 26 | * |
||
| 27 | * @return bool |
||
| 28 | */ |
||
| 29 | public function authArrayKeysExist($keys, $parameters) |
||
| 30 | {
|
||
| 31 | foreach ($keys as $key) {
|
||
| 32 | if (!array_key_exists($key, $parameters)) {
|
||
| 33 | return false; |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | return true; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Add header to Guzzle HTTP options array |
||
| 42 | * |
||
| 43 | * @param array $options An options array |
||
| 44 | * @param string $headerName Name of the header to input into the Guzzle options array |
||
| 45 | * @param mixed $headerValue Value of the header |
||
| 46 | * |
||
| 47 | * @return mixed options array (transformed) |
||
| 48 | */ |
||
| 49 | public function addHeader($options, $headerName, $headerValue) |
||
| 53 | } |
||
| 54 | } |