Nelmio\SecurityBundle\EventListener\ExternalRedirectListener::__construct PHP Method

__construct() public method

public __construct ( boolean $abort = true, string $override = null, string $forwardAs = null, mixed $targetValidator = null, Psr\Log\LoggerInterface $logger = null, Symfony\Component\Routing\Generator\UrlGeneratorInterface $generator = null )
$abort boolean If true, the offending redirects are turned into 403 responses, can't be combined with $override
$override string Absolute path, complete URL or route name that must be used instead of the offending redirect's url
$forwardAs string Name of the route-/query string parameter the blocked url will be passed to destination location
$targetValidator mixed array of hosts to be whitelisted, or regex that matches whitelisted hosts, or implementation of TargetValidator
$logger Psr\Log\LoggerInterface A logger, if it's present, detected offenses are logged at the warning level
$generator Symfony\Component\Routing\Generator\UrlGeneratorInterface Router or equivalent that can generate a route, only if override is a route name
    public function __construct($abort = true, $override = null, $forwardAs = null, $targetValidator = null, LoggerInterface $logger = null, UrlGeneratorInterface $generator = null)
    {
        if ($override && $abort) {
            throw new \LogicException('The ExternalRedirectListener can not abort *and* override redirects at the same time.');
        }
        $this->abort = $abort;
        $this->override = $override;
        $this->forwardAs = $forwardAs;
        if (is_string($targetValidator) || is_array($targetValidator)) {
            $targetValidator = new WhitelistBasedTargetValidator($targetValidator);
        } elseif ($targetValidator !== null && !$targetValidator instanceof TargetValidator) {
            throw new \LogicException('$targetValidator should be an array of hosts, a regular expression, or an implementation of TargetValidator.');
        }
        $this->targetValidator = $targetValidator;
        $this->logger = $logger;
        $this->generator = $generator;
    }