Overview

Namespaces

  • Autarky
    • Config
      • Loaders
    • Console
    • Container
      • Exception
      • Factory
      • Proxy
    • Database
    • Errors
    • Events
    • Files
    • Http
    • Logging
    • Providers
    • Routing
      • Events
    • Testing
    • TwigTemplating
      • Extensions
    • Utils

Classes

  • Configuration
  • Controller
  • DefaultRouteConfigurator
  • Route
  • RoutePathGenerator
  • Router
  • RoutingProvider
  • UrlGenerator

Interfaces

  • InvokerInterface
  • RoutePathGeneratorInterface
  • RouterInterface

Traits

  • ControllerTrait
  • Overview
  • Namespace
  • Class

Class Route

Class that represents a single route in the application.

Namespace: Autarky\Routing
Located at Routing/Route.php
Methods summary
public
# __construct( array $methods, string $pattern, callable $controller, string $name = null, array $options = [] )

Parameters

$methods
HTTP methods allowed for this route
$pattern
$controller
$name
$options
public string[]
# getMethods( )

Get the methods the route responds to.

Get the methods the route responds to.

Returns

string[]
public string
# getPattern( )

Get the URI pattern the route should match against.

Get the URI pattern the route should match against.

Returns

string
public callable
# getController( )

Get the callable controller for the route.

Get the callable controller for the route.

Returns

callable
public string|null
# getName( )

Get the route's name.

Get the route's name.

Returns

string|null
public array
# getOptions( )

Get the route options.

Get the route options.

Returns

array
public mixed
# getOption( $option )

Get a route option.

Get a route option.

Parameters

$option
string

Returns

mixed
Returns null if option not set.
public
# addBeforeHook( string $hook )

Add a before hook.

Add a before hook.

Parameters

$hook
public
# addAfterHook( string $hook )

Add an after hook.

Add an after hook.

Parameters

$hook
public
# addHook( string $when, string $hook )

Add a before or after hook.

Add a before or after hook.

Parameters

$when
"before" or "after"
$hook
public string[]
# getBeforeHooks( )

Get the route's before hooks.

Get the route's before hooks.

Returns

string[]
public string[]
# getAfterHooks( )

Get the route's after hooks.

Get the route's after hooks.

Returns

string[]
public
# setParams( array $params )

When a match against the route has been confirmed, extract the parameters from the URI and pass them as an associative array to this method.

When a match against the route has been confirmed, extract the parameters from the URI and pass them as an associative array to this method.

Parameters

$params
public array
# getParams( )

Get the parameters. Can only be called on a route that has been matched against an URI (i.e. setParams has been called)

Get the parameters. Can only be called on a route that has been matched against an URI (i.e. setParams has been called)

Returns

array

Throws

BadMethodCallException
If route has not been matched yet
public static
# setRouter( Autarky\Routing\RouterInterface $router )

Set the router the route objects use.

Set the router the route objects use.

Somewhat of a hack to make var_export caching work.

Parameters

$router
public static static
# __set_state( array $data )

Re-build a Route object from data that has been var_export-ed.

Re-build a Route object from data that has been var_export-ed.

Parameters

$data

Returns

static
Properties summary
protected static Autarky\Routing\Router $router
#
protected array $methods
#
protected string $pattern
#
protected callable $controller
#
protected array $options
#
protected null|string $name
#
protected array|null $params
# null
Autarky Framework API documentation generated by ApiGen