function compose(SiteUrl $url, array $parameters) { if ($this->requestPart->is(WebRequestPart::GET)) { if (array_key_exists($this->name, $parameters)) { $url->addQueryArgument($this->name, (string) $parameters[$this->name]); } else { if (!$this->isOptional) { if ($this->defaultValue) { $url->addQueryArgument($this->name, $this->defaultValue); } else { // FIXME: use exception Assert::isUnreachable('missing %s parameter', $this->name); } } } } }
function post($uri, array $routeData = array()) { $this->routes[] = new Route($uri, $routeData, WebRequestPart::post()); }
/** * Gets the variable from the specified request part * * @throws ArgumentException if such variable does not exist * @param string $variableName name of the variable to be retreived from the request * @param WebRequestPart $part optional specification of request scope where variable should * be looked up * @return scalar */ function getVar($variableName, WebRequestPart $part = null) { $vars = $part ? $this->vars[$part->getValue()] : $this->allVars; if (isset($variableName, $vars)) { return $vars[$variableName]; } throw new ArgumentException('variableName', 'argument is not defined'); }