Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • none

Classes

  • Application
  • PresenterFactory
  • Request

Interfaces

  • IPresenter
  • IPresenterFactory
  • IResponse
  • IRouter

Exceptions

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