/** * When creating this subscriber, you can configure a number of options. * * - refresh_client_matcher: RequestMatcher to identify valid refresh clients. * - refresh_client_ips: IP or array of IPs that are allowed to refresh. * * Only set one of refresh_client_ips and refresh_client_matcher. * * @param array $options Options to overwrite the default options * * @throws \InvalidArgumentException if unknown keys are found in $options */ public function __construct(array $options = []) { $resolver = new OptionsResolver(); $resolver->setDefaults(['refresh_client_matcher' => null, 'refresh_client_ips' => null]); $options = $resolver->resolve($options); parent::__construct($options['refresh_client_matcher'], $options['refresh_client_ips']); }
/** * When creating this subscriber, you can configure a number of options. * * - purge_method: HTTP method that identifies purge requests. * - purge_client_matcher: RequestMatcher to identify valid purge clients. * - purge_client_ips: IP or array of IPs that are allowed to purge. * * Only set one of purge_client_ips and purge_client_matcher. * * @param array $options Options to overwrite the default options * * @throws \InvalidArgumentException if unknown keys are found in $options */ public function __construct(array $options = []) { $resolver = new OptionsResolver(); if (method_exists($resolver, 'setDefined')) { // this was only added in symfony 2.6 $resolver->setDefined(['purge_client_matcher', 'purge_client_ips', 'purge_method']); } else { $resolver->setOptional(['purge_client_matcher', 'purge_client_ips', 'purge_method']); } $resolver->setDefaults(['purge_client_matcher' => null, 'purge_client_ips' => null, 'purge_method' => static::DEFAULT_PURGE_METHOD]); $this->options = $resolver->resolve($options); parent::__construct($this->options['purge_client_matcher'], $this->options['purge_client_ips']); }