AloFramework documentation
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download

Namespaces

  • Alo
    • Cache
    • CLI
    • Controller
    • Db
    • Exception
    • FileSystem
    • Session
    • Statics
    • Test
    • Validators
    • Windows
  • Controller
  • None
  • PHP

Classes

  • AbstractController
  • AbstractErrorController
  • Router

Class Router

Handles routing to the correct controller and method

Namespace: Alo\Controller
Author: Art <a.molcanovas@gmail.com>
Located at sys/class/alo/controller/router.php

Methods summary

public Alo\Controller\Router
# init( )

Initialises the router

Initialises the router

Returns

Alo\Controller\Router

Author

Art <a.molcanovas@gmail.com>
protected Alo\Controller\Router
# tryCall( )

Tries to call the appropriate class' method

Tries to call the appropriate class' method

Returns

Alo\Controller\Router

Throws

Alo\Exception\ControllerException
If the controller is already the error controller

Author

Art <a.molcanovas@gmail.com>

Uses

Alo\Controller\Router::forceError()

Used by

Alo\Controller\Router::forceError()
protected Alo\Controller\Router
# forceError( string $msg = null )

Forces the error controller

Forces the error controller

Parameters

$msg
string
$msg Optionally, the error message thrown by ReflectionClass or ReflectionMethod

Returns

Alo\Controller\Router

Throws

Alo\Exception\ControllerException
If the controller is already the error controller

Author

Art <a.molcanovas@gmail.com>

Uses

Alo\Controller\Router::tryCall()

Used by

Alo\Controller\Router::tryCall()
public Alo\Controller\Router
# initNoCall( )

Same as init(), but without attempting to call the controller

Same as init(), but without attempting to call the controller

Returns

Alo\Controller\Router

Throws

Alo\Exception\ControllerException
When the config file is not found
Alo\Exception\ControllerException
When $error_controller_class is not present in the config file
Alo\Exception\ControllerException
When The default controller is not present in the config file
Alo\Exception\ControllerException
When $routes is not a valid array
Alo\Exception\ControllerException
When a route value is not an array.

Author

Art <a.molcanovas@gmail.com>
protected Alo\Controller\Router
# resolvePath( )

Resolves the controller/method path

Resolves the controller/method path

Returns

Alo\Controller\Router

Author

Art <a.molcanovas@gmail.com>
protected Alo\Controller\Router
# init_routes( )

Initialises the routing variables

Initialises the routing variables

Returns

Alo\Controller\Router

Throws

Alo\Exception\ControllerException
When the config file is not found
Alo\Exception\ControllerException
When $error_controller_class is not present in the config file
Alo\Exception\ControllerException
When The default controller is not present in the config file
Alo\Exception\ControllerException
When $routes is not a valid array
Alo\Exception\ControllerException
When a route value is not an array.

Author

Art <a.molcanovas@gmail.com>
protected Alo\Controller\Router
# init_path( )

Initialises the raw path variable

Initialises the raw path variable

Returns

Alo\Controller\Router

Author

Art <a.molcanovas@gmail.com>
protected Alo\Controller\Router
# init_server_vars( )

Initialises most server variables

Initialises most server variables

Returns

Alo\Controller\Router

Author

Art <a.molcanovas@gmail.com>
public boolean
# is_cli_request( )

Returns whether this is a CLI request

Returns whether this is a CLI request

Returns

boolean

Author

Art <a.molcanovas@gmail.com>
public boolean
# is_ajax_request( )

Returns whether this is an AJAX request

Returns whether this is an AJAX request

Returns

boolean

Author

Art <a.molcanovas@gmail.com>
public string
# getErrController( )

Returns the error controller name

Returns the error controller name

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getMethod( )

Returns the controller method name

Returns the controller method name

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getController( )

Returns the controller name

Returns the controller name

Returns

string

Author

Art <a.molcanovas@gmail.com>
public integer
# getPort( )

Returns the request port used

Returns the request port used

Returns

integer

Author

Art <a.molcanovas@gmail.com>
public string
# getDir( )

Returns the directory name

Returns the directory name

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getRemoteAddr( )

Returns the request remote IP

Returns the request remote IP

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getRequestMethod( )

Returns the request method used

Returns the request method used

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getRequestScheme( )

Returns the request scheme used

Returns the request scheme used

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getServerAddr( )

Returns the server internal IP

Returns the server internal IP

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getServerName( )

Returns the server name

Returns the server name

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# getPath( )

Returns the request path

Returns the request path

Returns

string

Author

Art <a.molcanovas@gmail.com>
public string
# __toString( )

Returns a string representation of the object data

Returns a string representation of the object data

Returns

string

Author

Art <a.molcanovas@gmail.com>

Magic methods summary

Constants summary

string CONTROLLER_NAMESPACE '\Controller\\'
#

Pretty self-explanatory, isn't it?

Pretty self-explanatory, isn't it?

string PREG_DELIMITER '~'
#

Delimiter used in the regex checking

Delimiter used in the regex checking

Properties summary

protected static array $route_defaults
#

Default params for a route

Default params for a route

protected string $server_name
#

The server name

The server name

protected string $server_addr
#

The server IP

The server IP

protected integer $port
#

The port in use

The port in use

protected string $remote_addr
#

The remote address

The remote address

protected string $request_scheme
#

The request scheme

The request scheme

protected string $path
#

The raw path info

The raw path info

protected string $request_method
#

Request method in use

Request method in use

protected string $dir
#

Directory name

Directory name

protected string $controller
#

Controller name

Controller name

protected string $method
#

Method name

Method name

protected array $method_args
#

Arguments to pass on to the method

Arguments to pass on to the method

protected string $err_controller
#

The error controller name

The error controller name

protected string $default_controller
#

The default controller

The default controller

protected array $routes
#

The routes array

The routes array

protected boolean $is_cli_request
#

Whether we're dealing with a CLI request...

Whether we're dealing with a CLI request...

protected boolean $is_ajax_request
#

Whether we're dealing with an AJAX request

Whether we're dealing with an AJAX request

AloFramework documentation API documentation generated by ApiGen 2.8.0