Exemplo n.º 1
0
    /**
     * Set POST Data
     *
     * @param array|string $field
     *   POST Field
     *
     * @param mixed|optional $value
     *   Field Value
     *
     * @return Next\HTTP\Request
     *   Request Instance (Fluent Interface)
     *
     * @throws Next\HTTP\Request\RequestException
     *   <strong>$value</strong> argument is NULL, case in which a
     *   possible RAW Data should be considered instead
     */
    public function setPostData($field, $value = NULL)
    {
        if (is_array($field)) {
            foreach ($field as $f => $v) {
                $this->setPostData($f, $v);
            }
        } else {
            if (is_null($value)) {
                throw RequestException::wrongUse('Wrong use of Request::setPostData(). POST Data must have a field name and a value.

                    <br />

                    If you don\'t have a field name, consider use Request::setRawPostData() instead');
            }
            $this->postData[$field] =& $value;
        }
        return $this;
    }
Exemplo n.º 2
0
 /**
  * HTTP GET Param not found
  *
  * @param Next\HTTP\Request\RequestException $e
  *     RequestException caught
  *
  * @return Next\Controller\ControllerException
  *   Exception for missing HTTP GET Param
  */
 public static function paramNotFound(RequestException $e)
 {
     return new self($e->getMessage(), self::PARAM_NOT_FOUND);
 }