Yaf_Request_Abstract::setRequestUri

(Yaf >=2.1.0)

Yaf_Request_Abstract::setRequestUriSet the request URI

Description

public function Yaf_Request_Abstract::setRequestUri(string $uri): Yaf_Request_Abstract

Set the request URI, overriding the one detected from the environment.

This is useful when dispatching manually, e.g. in tests, with a URI that differs from the real one.

Parameters

uri

The request URI to set.

Return Values

Returns the request object itself.

Examples

Example #1 Yaf_Request_Abstract::setRequestUri() example

<?php
$request = new Yaf_Request_Simple("CLI", "Index", "Index", "Index");

// Dispatch manually against a URI that differs from the real one
$request->setRequestUri("/product/view/id/17");

var_dump($request->getRequestUri());
?>

The above example will output something similar to:

string(19) "/product/view/id/17"

See Also

add a note

User Contributed Notes

There are no user contributed notes for this page.