public function setTarget($target)
    {
        if (!is_string($target) || $target == '') {
            throw new \InvalidArgumentException('No valid URL given.');
        }

        $this->target = $target;

        // Set meta refresh content if header location is ignored
        $this->setContent(
            sprintf('<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0; url=%1$s" />
    </head>
    <body>
        <p>Redirecting to <a href="%1$s">%1$s</a>.
    </body>
</html>', htmlspecialchars($target, ENT_QUOTES, 'UTF-8')));

        // Set header location
        $this->setHeader('Location', $target);

        return $this;
    }
public function setTarget($target)
    {
        if (!is_string($target) || $target == '') {
            throw new \InvalidArgumentException('No valid URL given.');
        }

        $this->target = $target;

        // Set meta refresh content if header location is ignored
        $this->setContent(
            sprintf('<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0; url=%1$s" />
    </head>
    <body>
        <p>Redirecting to <a href="%1$s">%1$s</a>.
    </body>
</html>', htmlspecialchars($target, ENT_QUOTES, 'UTF-8')));

        // Set header location
        $this->setHeader('Location', $target);

        return $this;
    }
public function setTarget ( $ target ) { if ( ! is_string ( $ target ) || $ target == '' ) { throw new \ InvalidArgumentException ( 'No valid URL given.' ) ; } $ this -> target = $ target ; // Set meta refresh content if header location is ignored
 $ this -> setContent ( sprintf ( '<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0; url=%1$s" />
    </head>
    <body>
        <p>Redirecting to <a href="%1$s">%1$s</a>.
    </body>
</html>' , htmlspecialchars ( $ target , ENT_QUOTES , 'UTF-8' ) ) ) ; // Set header location
 $ this -> setHeader ( 'Location' , $ target ) ; return $ this ; }
Sets the target URL where the redirections points to.

@param string $target
The target URL

@return self
Sets the target URL where the redirections points to .