php8.5
Home/ Manual/ yaf / yaf_application/ Yaf_Application::getDispatcher

Yaf_Application::getDispatcher

PHP function Edit on GitHub ✎

(Yaf >=1.0.0)

Get Yaf_Dispatcher instance

Description

Yaf_Application::getDispatcher(): Yaf_Dispatcher|null

Retrieve the Yaf_Dispatcher instance used by this application.

Parameters Parameters

Return Values

The Yaf_Dispatcher instance, or null if the application is not properly initialized.

Examples

Yaf_Application::getDispatcher() example

php
<?php
$config = array(
    "application" => array(
        "directory" => realpath(dirname(__FILE__)) . "/application",
    ),
);

/** Yaf_Application */
$application = new Yaf_Application($config);
print_r($application->getDispatcher());
?>

The above example will output something similar to:

output
Yaf_Dispatcher Object
(
    [_router:protected] => Yaf_Router Object
        (
            [_routes:protected] => Array
                (
                    [_default] => Yaf_Route_Static Object
                        (
                        )

                )

            [_current:protected] => 
        )

    [_view:protected] => 
    [_request:protected] => Yaf_Request_Http Object
        (
            [method] => Cli
        )

    [_plugins:protected] => Array
        (
        )

    [_auto_render:protected] => 1
    [_return_response:protected] => 
    [_instantly_flush:protected] => 1
    [_default_module:protected] => Index
    [_default_controller:protected] => Index
    [_default_action:protected] => index
)

Source: reference/yaf/yaf_application/getdispatcher.xml · from the official PHP manual (php/doc-en)