/usr/share/php/Nette/Application/Request.php is in php-nette 2.4-20160731-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | <?php
/**
* This file is part of the Nette Framework (https://nette.org)
* Copyright (c) 2004 David Grudl (https://davidgrudl.com)
*/
namespace Nette\Application;
use Nette;
/**
* Presenter request.
*
* @property string $presenterName
* @property array $parameters
* @property array $post
* @property array $files
* @property string|NULL $method
*/
class Request
{
use Nette\SmartObject;
/** method */
const FORWARD = 'FORWARD';
/** flag */
const SECURED = 'secured';
/** flag */
const RESTORED = 'restored';
/** @var string|NULL */
private $method;
/** @var array */
private $flags = [];
/** @var string */
private $name;
/** @var array */
private $params;
/** @var array */
private $post;
/** @var array */
private $files;
/**
* @param string fully qualified presenter name (module:module:presenter)
* @param string method
* @param array variables provided to the presenter usually via URL
* @param array variables provided to the presenter via POST
* @param array all uploaded files
* @param array flags
*/
public function __construct($name, $method = NULL, array $params = [], array $post = [], array $files = [], array $flags = [])
{
$this->name = $name;
$this->method = $method;
$this->params = $params;
$this->post = $post;
$this->files = $files;
$this->flags = $flags;
}
/**
* Sets the presenter name.
* @param string
* @return self
*/
public function setPresenterName($name)
{
$this->name = $name;
return $this;
}
/**
* Retrieve the presenter name.
* @return string
*/
public function getPresenterName()
{
return $this->name;
}
/**
* Sets variables provided to the presenter.
* @return self
*/
public function setParameters(array $params)
{
$this->params = $params;
return $this;
}
/**
* Returns all variables provided to the presenter (usually via URL).
* @return array
*/
public function getParameters()
{
return $this->params;
}
/**
* Returns a parameter provided to the presenter.
* @param string
* @return mixed
*/
public function getParameter($key)
{
return isset($this->params[$key]) ? $this->params[$key] : NULL;
}
/**
* Sets variables provided to the presenter via POST.
* @return self
*/
public function setPost(array $params)
{
$this->post = $params;
return $this;
}
/**
* Returns a variable provided to the presenter via POST.
* If no key is passed, returns the entire array.
* @param string
* @return mixed
*/
public function getPost($key = NULL)
{
if (func_num_args() === 0) {
return $this->post;
} elseif (isset($this->post[$key])) {
return $this->post[$key];
} else {
return NULL;
}
}
/**
* Sets all uploaded files.
* @return self
*/
public function setFiles(array $files)
{
$this->files = $files;
return $this;
}
/**
* Returns all uploaded files.
* @return array
*/
public function getFiles()
{
return $this->files;
}
/**
* Sets the method.
* @param string|NULL
* @return self
*/
public function setMethod($method)
{
$this->method = $method;
return $this;
}
/**
* Returns the method.
* @return string|NULL
*/
public function getMethod()
{
return $this->method;
}
/**
* Checks if the method is the given one.
* @param string
* @return bool
*/
public function isMethod($method)
{
return strcasecmp($this->method, $method) === 0;
}
/**
* Sets the flag.
* @param string
* @param bool
* @return self
*/
public function setFlag($flag, $value = TRUE)
{
$this->flags[$flag] = (bool) $value;
return $this;
}
/**
* Checks the flag.
* @param string
* @return bool
*/
public function hasFlag($flag)
{
return !empty($this->flags[$flag]);
}
}
|