Esempio n. 1
0
 /**
  * ResponseRedirect constructor.
  * @param string $route путь для перенаправления
  * @param string $message сообщение, с которым будет выполнено перенаправление (добавляется в GET параметры с ключом redirectmessage)
  */
 public function __construct($route, $message = "")
 {
     $route = $message == "" ? $route : $route . "?redirectmessage=" . $message;
     self::$logger = Service::get("logger");
     self::$logger->debug("Redirecting to {$route} ...");
     parent::__construct("", ResponseType::MOVED_PERMANENTLY);
     parent::addHeader("Location", $route);
 }
 /**
  * ResponseRedirect constructor.
  * @param string $url
  * @param string $content
  * @param string $type
  * @param int $code
  *
  * @throws InvalidArgumentException
  */
 public function __construct($url, $content = '', $type = 'text/html', $code = 302)
 {
     if (empty($url)) {
         throw new InvalidArgumentException('Cannot redirect to an empty URL.');
     }
     parent::__construct($content, $type, $code);
     $this->setTargetUrl($url);
 }
 /**
  * ResponseRedirect constructor.
  * @param string $url
  * @param int $code
  * @param null $msg
  */
 public function __construct($url = '', $code = 301, $msg = null)
 {
     parent::__construct('', 'text/html', $code);
     $this->code = $code;
     $this->url = $url;
     if (!is_null($msg)) {
         Service::get('session')->addFlush('error', $msg);
     }
 }
Esempio n. 4
0
 /**
  * JsonResponse constructor.
  * @param array $content
  * @param string $type
  * @param int $code
  */
 public function __construct($content, $type = 'text/html', $code = 200)
 {
     parent::__construct($content, $type, $code);
 }