private function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'cache_lifetime' => 86400 * 30, // 30 days
            'default_ttl' => 0,
            //Deprecated as of v1.3, to be removed in v2.0. Use respect_response_cache_directives instead
            'respect_cache_headers' => null,
            'hash_algo' => 'sha1',
            'methods' => ['GET', 'HEAD'],
            'respect_response_cache_directives' => ['no-cache', 'private', 'max-age', 'no-store'],
            'cache_key_generator' => null,
            'cache_listeners' => [],
        ]);

        $resolver->setAllowedTypes('cache_lifetime', ['int', 'null']);
        $resolver->setAllowedTypes('default_ttl', ['int', 'null']);
        $resolver->setAllowedTypes('respect_cache_headers', ['bool', 'null']);
        $resolver->setAllowedTypes('methods', 'array');
        $resolver->setAllowedTypes('cache_key_generator', ['null', 'Http\Client\Common\Plugin\Cache\Generator\CacheKeyGenerator']);
        $resolver->setAllowedValues('hash_algo', hash_algos());
        $resolver->setAllowedValues('methods', function ($value) {
            /* RFC7230 sections 3.1.1 and 3.2.6 except limited to uppercase characters. */
            $matches = preg_grep('/[^A-Z0-9!#$%&\'*+\-.^_`|~]/', $value);

            return empty($matches);
        });
        $resolver->setAllowedTypes('cache_listeners', ['array']);

        $resolver->setNormalizer('respect_cache_headers', function (Options $options, $value) {
            if (null !== $value) {
                @trigger_error('The option "respect_cache_headers" is deprecated since version 1.3 and will be removed in 2.0. Use "respect_response_cache_directives" instead.', E_USER_DEPRECATED);
            }

            return null === $value ? true : $value;
        });

        $resolver->setNormalizer('respect_response_cache_directives', function (Options $options, $value) {
            if (false === $options['respect_cache_headers']) {
                return [];
            }

            return $value;
        });
    }
private function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'cache_lifetime' => 86400 * 30, // 30 days
            'default_ttl' => 0,
            //Deprecated as of v1.3, to be removed in v2.0. Use respect_response_cache_directives instead
            'respect_cache_headers' => null,
            'hash_algo' => 'sha1',
            'methods' => ['GET', 'HEAD'],
            'respect_response_cache_directives' => ['no-cache', 'private', 'max-age', 'no-store'],
            'cache_key_generator' => null,
            'cache_listeners' => [],
        ]);

        $resolver->setAllowedTypes('cache_lifetime', ['int', 'null']);
        $resolver->setAllowedTypes('default_ttl', ['int', 'null']);
        $resolver->setAllowedTypes('respect_cache_headers', ['bool', 'null']);
        $resolver->setAllowedTypes('methods', 'array');
        $resolver->setAllowedTypes('cache_key_generator', ['null', 'Http\Client\Common\Plugin\Cache\Generator\CacheKeyGenerator']);
        $resolver->setAllowedValues('hash_algo', hash_algos());
        $resolver->setAllowedValues('methods', function ($value) {
            /* RFC7230 sections 3.1.1 and 3.2.6 except limited to uppercase characters. */
            $matches = preg_grep('/[^A-Z0-9!#$%&\'*+\-.^_`|~]/', $value);

            return empty($matches);
        });
        $resolver->setAllowedTypes('cache_listeners', ['array']);

        $resolver->setNormalizer('respect_cache_headers', function (Options $options, $value) {
            if (null !== $value) {
                @trigger_error('The option "respect_cache_headers" is deprecated since version 1.3 and will be removed in 2.0. Use "respect_response_cache_directives" instead.', E_USER_DEPRECATED);
            }

            return null === $value ? true : $value;
        });

        $resolver->setNormalizer('respect_response_cache_directives', function (Options $options, $value) {
            if (false === $options['respect_cache_headers']) {
                return [];
            }

            return $value;
        });
    }
private function configureOptions ( OptionsResolver $ resolver ) { $ resolver -> setDefaults ( [ 'cache_lifetime' => 86400 * 30 , // 30 days 'default_ttl' => 0 , //Deprecated as of v1.3, to be removed in v2.0. Use respect_response_cache_directives instead 'respect_cache_headers' => null , 'hash_algo' => 'sha1' , 'methods' => [ 'GET' , 'HEAD' ] , 'respect_response_cache_directives' => [ 'no-cache' , 'private' , 'max-age' , 'no-store' ] , 'cache_key_generator' => null , 'cache_listeners' => [ ] , ] ) ; $ resolver -> setAllowedTypes ( 'cache_lifetime' , [ 'int' , 'null' ] ) ; $ resolver -> setAllowedTypes ( 'default_ttl' , [ 'int' , 'null' ] ) ; $ resolver -> setAllowedTypes ( 'respect_cache_headers' , [ 'bool' , 'null' ] ) ; $ resolver -> setAllowedTypes ( 'methods' , 'array' ) ; $ resolver -> setAllowedTypes ( 'cache_key_generator' , [ 'null' , 'Http\Client\Common\Plugin\Cache\Generator\CacheKeyGenerator' ] ) ; $ resolver -> setAllowedValues ( 'hash_algo' , hash_algos ( ) ) ; $ resolver -> setAllowedValues ( 'methods' , function ( $ value ) { /* RFC7230 sections 3.1.1 and 3.2.6 except limited to uppercase characters. */ $ matches = preg_grep ( '/[^A-Z0-9!#$%&\'*+\-.^_`|~]/' , $ value ) ; return empty ( $ matches ) ; } ) ; $ resolver -> setAllowedTypes ( 'cache_listeners' , [ 'array' ] ) ; $ resolver -> setNormalizer ( 'respect_cache_headers' , function ( Options $ options , $ value ) { if ( null !== $ value ) { @ trigger_error ( 'The option "respect_cache_headers" is deprecated since version 1.3 and will be removed in 2.0. Use "respect_response_cache_directives" instead.' , E_USER_DEPRECATED ) ; } return null === $ value ? true : $ value ; } ) ; $ resolver -> setNormalizer ( 'respect_response_cache_directives' , function ( Options $ options , $ value ) { if ( false === $ options [ 'respect_cache_headers' ] ) { return [ ] ; } return $ value ; } ) ; }
Configure an options resolver.

@param OptionsResolver $resolver
Configure an options resolver .