Dutch PHP Conference 2027

Yaf_Request_Abstract::setRouted

(Yaf >=1.0.0)

Yaf_Request_Abstract::setRoutedMark the request as routed

Beschreibung

final public function Yaf_Request_Abstract::setRouted(bool $flag = true): Yaf_Request_Abstract

Mark the request as routed

This is called by the router once routing has succeeded. Calling it manually can prevent custom routers from being run afterwards.

Parameter-Liste

flag

The state to set. Defaults to true.

Rückgabewerte

Returns the request object itself.

Beispiele

Beispiel #1 Yaf_Request_Abstract::setRouted() example

<?php
class ApiRouter extends Yaf_Route_Interface
{
    public function route(Yaf_Request_Abstract $request)
    {
        if (0 !== strpos($request->getRequestUri(), "/api/")) {
            return false;
        }

        $request->setControllerName("Api")
                ->setActionName("handle");

        // Prevent routers registered after this one from running
        $request->setRouted();

        return true;
    }

    public function assemble(array $info, array $query = null) {}
}
?>

Siehe auch

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top