private function setAuthenticationParameters(
        $keys = null,
        $params = null,
        $type = 'req'
    ) {
        if (!empty($keys['auth'][$type])) {
            if ($this->auth == null) {
                $msg = 'No Auth object provided.  (HINT: Set your Auth data using '
                     . '"$API->setAuth(Auth $auth)" or $API\' constructor.  '
                     . 'See https://TODO for details.';
                throw new ApiAuthenticationException($msg);
            }

            // Set authentication parameters
            $auth_group = false;
            foreach ($keys['auth'][$type] as $k) {
                if (is_array($k) && !empty($k)) {
                    /*
                     * Different auth key groups may be required.
                     * In these situations, must assert that each
                     * key within an auth key group exists. Exits
                     * once the first auth key group is validated.
                     */

                    if ($auth_group && $auth_group_validated) {
                        /*
                        * At this point an authentication group has been satisfied
                        * and we don't need to process additional groups.
                        */
                        continue;
                    }

                    $auth_group = true;
                    $auth_group_validated = true;
                    foreach ($k as $g) {
                        if (!isset($params[$g])) {
                            $v = $this->auth->getAuthKeyVar($g);
                            if (!$v) {
                                $auth_group_validated = false;
                                break;
                            }
                            $params[$g] = $v;
                        }
                    }
                } else {
                    if (!isset($params[$k])) {
                        $v = $this->auth->getAuthKeyVar($k);
                        if (!$v) {
                            if ($type == 'req') {
                                $msg = 'Authentication key `'.$k.'` is required. '
                                     . 'HINT: Set your Auth data using "$API->'
                                     . 'setAuth(Auth $auth)" or $API\' constructor. '
                                     . 'See https://TODO for details.';
                                throw new ApiAuthenticationException($msg);
                            } else {
                                // optional
                                continue;
                            }
                        }
                        $params[$k] = $v;
                    }
                }
            }

            // If keys configured with authentication groups, verify one was validated
            if ($auth_group && !$auth_group_validated) {
                $msg = 'A required authentication key group was not satisfied. '
                     . '(HINT: Reference the $keys '
                     . 'property at the top of the API class file for '
                     . 'required and optional parameters.)';
                throw new ApiAuthenticationException($msg);
            }
        }

        return $params;
    }
private function setAuthenticationParameters(
        $keys = null,
        $params = null,
        $type = 'req'
    ) {
        if (!empty($keys['auth'][$type])) {
            if ($this->auth == null) {
                $msg = 'No Auth object provided.  (HINT: Set your Auth data using '
                     . '"$API->setAuth(Auth $auth)" or $API\' constructor.  '
                     . 'See https://TODO for details.';
                throw new ApiAuthenticationException($msg);
            }

            // Set authentication parameters
            $auth_group = false;
            foreach ($keys['auth'][$type] as $k) {
                if (is_array($k) && !empty($k)) {
                    /*
                     * Different auth key groups may be required.
                     * In these situations, must assert that each
                     * key within an auth key group exists. Exits
                     * once the first auth key group is validated.
                     */

                    if ($auth_group && $auth_group_validated) {
                        /*
                        * At this point an authentication group has been satisfied
                        * and we don't need to process additional groups.
                        */
                        continue;
                    }

                    $auth_group = true;
                    $auth_group_validated = true;
                    foreach ($k as $g) {
                        if (!isset($params[$g])) {
                            $v = $this->auth->getAuthKeyVar($g);
                            if (!$v) {
                                $auth_group_validated = false;
                                break;
                            }
                            $params[$g] = $v;
                        }
                    }
                } else {
                    if (!isset($params[$k])) {
                        $v = $this->auth->getAuthKeyVar($k);
                        if (!$v) {
                            if ($type == 'req') {
                                $msg = 'Authentication key `'.$k.'` is required. '
                                     . 'HINT: Set your Auth data using "$API->'
                                     . 'setAuth(Auth $auth)" or $API\' constructor. '
                                     . 'See https://TODO for details.';
                                throw new ApiAuthenticationException($msg);
                            } else {
                                // optional
                                continue;
                            }
                        }
                        $params[$k] = $v;
                    }
                }
            }

            // If keys configured with authentication groups, verify one was validated
            if ($auth_group && !$auth_group_validated) {
                $msg = 'A required authentication key group was not satisfied. '
                     . '(HINT: Reference the $keys '
                     . 'property at the top of the API class file for '
                     . 'required and optional parameters.)';
                throw new ApiAuthenticationException($msg);
            }
        }

        return $params;
    }
private function setAuthenticationParameters ( $ keys = null , $ params = null , $ type = 'req' ) { if ( ! empty ( $ keys [ 'auth' ] [ $ type ] ) ) { if ( $ this -> auth == null ) { $ msg = 'No Auth object provided.  (HINT: Set your Auth data using ' . '"$API->setAuth(Auth $auth)" or $API\' constructor.  ' . 'See https://TODO for details.' ; throw new ApiAuthenticationException ( $ msg ) ; } // Set authentication parameters $ auth_group = false ; foreach ( $ keys [ 'auth' ] [ $ type ] as $ k ) { if ( is_array ( $ k ) && ! empty ( $ k ) ) { /*
                     * Different auth key groups may be required.
                     * In these situations, must assert that each
                     * key within an auth key group exists. Exits
                     * once the first auth key group is validated.
                     */ if ( $ auth_group && $ auth_group_validated ) { /*
                        * At this point an authentication group has been satisfied
                        * and we don't need to process additional groups.
                        */ continue ; } $ auth_group = true ; $ auth_group_validated = true ; foreach ( $ k as $ g ) { if ( ! isset ( $ params [ $ g ] ) ) { $ v = $ this -> auth -> getAuthKeyVar ( $ g ) ; if ( ! $ v ) { $ auth_group_validated = false ; break ; } $ params [ $ g ] = $ v ; } } } else { if ( ! isset ( $ params [ $ k ] ) ) { $ v = $ this -> auth -> getAuthKeyVar ( $ k ) ; if ( ! $ v ) { if ( $ type == 'req' ) { $ msg = 'Authentication key `' . $ k . '` is required. ' . 'HINT: Set your Auth data using "$API->' . 'setAuth(Auth $auth)" or $API\' constructor. ' . 'See https://TODO for details.' ; throw new ApiAuthenticationException ( $ msg ) ; } else { // optional continue ; } } $ params [ $ k ] = $ v ; } } } // If keys configured with authentication groups, verify one was validated if ( $ auth_group && ! $ auth_group_validated ) { $ msg = 'A required authentication key group was not satisfied. ' . '(HINT: Reference the $keys ' . 'property at the top of the API class file for ' . 'required and optional parameters.)' ; throw new ApiAuthenticationException ( $ msg ) ; } } return $ params ; }
Validate and set required authentication parameters from Auth object.

@param array $keys Array of required and optional
authentication and argument keys (string) for API method.
@param array $params API specific parameters.
@param string $type The type of authentication parameters to
process (optional or required).

@return array Paramters with authentication parameters of $type set.

@throws MyAllocator\phpsdk\src\Exception\ApiAuthenticationException
Validate and set required authentication parameters from Auth object .