src/ClientResolver.php
public function resolve(array $args, HandlerList $list)
    {
        $args['config'] = [];
        foreach ($this->argDefinitions as $key => $a) {
            // Add defaults, validate required values, and skip if not set.
            if (!isset($args[$key])) {
                if (isset($a['default'])) {
                    // Merge defaults in when not present.
                    if (is_callable($a['default'])
                        && (
                            is_array($a['default'])
                            || $a['default'] instanceof \Closure
                        )
                    ) {
                        $args[$key] = $a['default']($args);
                    } else {
                        $args[$key] = $a['default'];
                    }
                } elseif (empty($a['required'])) {
                    continue;
                } else {
                    $this->throwRequired($args);
                }
            }

            // Validate the types against the provided value.
            foreach ($a['valid'] as $check) {
                if (isset(self::$typeMap[$check])) {
                    $fn = self::$typeMap[$check];
                    if ($fn($args[$key])) {
                        goto is_valid;
                    }
                } elseif ($args[$key] instanceof $check) {
                    goto is_valid;
                }
            }

            $this->invalidType($key, $args[$key]);

            // Apply the value
            is_valid:
            if (isset($a['fn'])) {
                $a['fn']($args[$key], $args, $list);
            }

            if ($a['type'] === 'config') {
                $args['config'][$key] = $args[$key];
            }
        }

        return $args;
    }
public function resolve(array $args, HandlerList $list)
    {
        $args['config'] = [];
        foreach ($this->argDefinitions as $key => $a) {
            // Add defaults, validate required values, and skip if not set.
            if (!isset($args[$key])) {
                if (isset($a['default'])) {
                    // Merge defaults in when not present.
                    if (is_callable($a['default'])
                        && (
                            is_array($a['default'])
                            || $a['default'] instanceof \Closure
                        )
                    ) {
                        $args[$key] = $a['default']($args);
                    } else {
                        $args[$key] = $a['default'];
                    }
                } elseif (empty($a['required'])) {
                    continue;
                } else {
                    $this->throwRequired($args);
                }
            }

            // Validate the types against the provided value.
            foreach ($a['valid'] as $check) {
                if (isset(self::$typeMap[$check])) {
                    $fn = self::$typeMap[$check];
                    if ($fn($args[$key])) {
                        goto is_valid;
                    }
                } elseif ($args[$key] instanceof $check) {
                    goto is_valid;
                }
            }

            $this->invalidType($key, $args[$key]);

            // Apply the value
            is_valid:
            if (isset($a['fn'])) {
                $a['fn']($args[$key], $args, $list);
            }

            if ($a['type'] === 'config') {
                $args['config'][$key] = $args[$key];
            }
        }

        return $args;
    }
public function resolve ( array $ args , HandlerList $ list ) { $ args [ 'config' ] = [ ] ; foreach ( $ this -> argDefinitions as $ key => $ a ) { // Add defaults, validate required values, and skip if not set. if ( ! isset ( $ args [ $ key ] ) ) { if ( isset ( $ a [ 'default' ] ) ) { // Merge defaults in when not present. if ( is_callable ( $ a [ 'default' ] ) && ( is_array ( $ a [ 'default' ] ) || $ a [ 'default' ] instanceof \ Closure ) ) { $ args [ $ key ] = $ a [ 'default' ] ( $ args ) ; } else { $ args [ $ key ] = $ a [ 'default' ] ; } } elseif ( empty ( $ a [ 'required' ] ) ) { continue ; } else { $ this -> throwRequired ( $ args ) ; } } // Validate the types against the provided value. foreach ( $ a [ 'valid' ] as $ check ) { if ( isset ( self :: $ typeMap [ $ check ] ) ) { $ fn = self :: $ typeMap [ $ check ] ; if ( $ fn ( $ args [ $ key ] ) ) { goto is_valid ; } } elseif ( $ args [ $ key ] instanceof $ check ) { goto is_valid ; } } $ this -> invalidType ( $ key , $ args [ $ key ] ) ; // Apply the value is_valid : if ( isset ( $ a [ 'fn' ] ) ) { $ a [ 'fn' ] ( $ args [ $ key ] , $ args , $ list ) ; } if ( $ a [ 'type' ] === 'config' ) { $ args [ 'config' ] [ $ key ] = $ args [ $ key ] ; } } return $ args ; }
Resolves client configuration options and attached event listeners.
Check for missing keys in passed arguments

@param array       $args Provided constructor arguments.
@param HandlerList $list Handler list to augment.

@return array Returns the array of provided options.
@throws \InvalidArgumentException
@see Aws\AwsClient::__construct for a list of available options.
Resolves client configuration options and attached event listeners . Check for missing keys in passed arguments