ICanBoogie/Routing master
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • Routing
      • Controller
      • Route
      • RouteDispatcher

Classes

  • Controller
  • FormattedRoute
  • Helpers
  • Pattern
  • Route
  • RouteCollection
  • RouteDefinition
  • RouteDispatcher
  • RouteMaker

Interfaces

  • Exception
  • ToSlug

Exceptions

  • ActionNotDefined
  • ControllerNotDefined
  • PatternNotDefined
  • PatternRequiresValues
  • RouteNotDefined

Functions

  • absolutize_url
  • contextualize
  • decontextualize

Class RouteCollection

A route collection.

ICanBoogie\Routing\RouteCollection implements IteratorAggregate, ArrayAccess, Countable
Namespace: ICanBoogie\Routing
Located at RouteCollection.php

Methods summary

public
# __construct( array $definitions = [], boolean $trusted_definitions = false )

Parameters

$definitions
$trusted_definitions

ICanBoogie\Routing\RouteCollection::TRUSTED_DEFINITIONS if the definition can be trusted. This will speed up the construct process but the definitions will not be checked, nor will they be normalized.

public ICanBoogie\Routing\RouteCollection
# __call( string $method, array $arguments )

Adds a route definition using an HTTP method.

Adds a route definition using an HTTP method.

Parameters

$method
$arguments

Returns

ICanBoogie\Routing\RouteCollection
$this
protected ICanBoogie\Routing\RouteCollection
# add( array $definition, boolean $trusted_definition = false )

Adds a route definition.

Adds a route definition.

Note: The method does not revoke cache.

Parameters

$definition
$trusted_definition

ICanBoogie\Routing\RouteCollection::TRUSTED_DEFINITIONS if the method should be trusting the definition, in which case the method doesn't assert if the definition is valid, nor does it normalizes it.

Returns

ICanBoogie\Routing\RouteCollection
$this
public array
# resource( string $name, string $controller, array $options = [] )

Adds resource routes.

Adds resource routes.

Note: The route definitions for the resource are created by RouteMaker::resource. Both methods accept the same arguments.

Parameters

$name
$controller
$options

Returns

array

See

\ICanBoogie\Routing\RoutesMaker::resource
public
# getIterator( )

Implementation of

IteratorAggregate::getIterator()
public
# offsetExists( $offset )

Implementation of

ArrayAccess::offsetExists()
public ICanBoogie\Routing\Route
# offsetGet( string $id )

Returns a ICanBoogie\Routing\Route instance.

Returns a ICanBoogie\Routing\Route instance.

Parameters

$id
Route identifier.

Returns

ICanBoogie\Routing\Route

Throws

ICanBoogie\Routing\RouteNotDefined

Implementation of

ArrayAccess::offsetGet()
public
# offsetSet( string $id, array $route )

Defines a route.

Defines a route.

Parameters

$id
The identifier of the route.
$route
The route definition.

Implementation of

ArrayAccess::offsetSet()
public
# offsetUnset( string $offset )

Removes a route.

Removes a route.

Parameters

$offset
The identifier of the route.

Implementation of

ArrayAccess::offsetUnset()
public integer
# count( )

Returns the number of routes in the collection.

Returns the number of routes in the collection.

Returns

integer

Implementation of

Countable::count()
public ICanBoogie\Routing\Route|false|null
# find( string $uri, array|null & $captured = null, string $method = ICanBoogie\Routing\Request::METHOD_ANY )

Search for a route matching the specified pathname and method.

Search for a route matching the specified pathname and method.

Parameters

$uri

The URI to match. If the URI includes a query string it is removed before searching for a matching route.

$captured

The parameters captured from the URI. If the URI included a query string, its parsed params are stored under the __query__ key.

$method
One of HTTP\Request::METHOD_* methods.

Returns

ICanBoogie\Routing\Route|false|null
public ICanBoogie\Routing\RouteCollection
# filter( callable $filter )

Returns a new collection with filtered routes.

Returns a new collection with filtered routes.

Parameters

$filter

Returns

ICanBoogie\Routing\RouteCollection

Magic methods summary

public ICanBoogie\Routing\RouteCollection
# any( )

any(string $pattern, $controller, array $options=[]) Add a route for any HTTP method.

any(string $pattern, $controller, array $options=[]) Add a route for any HTTP method.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# connect( )

connect(string $pattern, $controller, array $options=[]) Add a route for the HTTP method CONNECT.

connect(string $pattern, $controller, array $options=[]) Add a route for the HTTP method CONNECT.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# delete( )

delete(string $pattern, $controller, array $options=[]) Add a route for the HTTP method DELETE.

delete(string $pattern, $controller, array $options=[]) Add a route for the HTTP method DELETE.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# get( )

get(string $pattern, $controller, array $options=[]) Add a route for the HTTP method GET.

get(string $pattern, $controller, array $options=[]) Add a route for the HTTP method GET.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# head( )

head(string $pattern, $controller, array $options=[]) Add a route for the HTTP method HEAD.

head(string $pattern, $controller, array $options=[]) Add a route for the HTTP method HEAD.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# options( )

options(string $pattern, $controller, array $options=[]) Add a route for the HTTP method OPTIONS.

options(string $pattern, $controller, array $options=[]) Add a route for the HTTP method OPTIONS.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# post( )

post(string $pattern, $controller, array $options=[]) Add a route for the HTTP method POST.

post(string $pattern, $controller, array $options=[]) Add a route for the HTTP method POST.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# put( )

put(string $pattern, $controller, array $options=[]) Add a route for the HTTP method PUT.

put(string $pattern, $controller, array $options=[]) Add a route for the HTTP method PUT.

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# patch( )

patch(string $pattern, $controller, array $options=[]) Add a route for the HTTP method PATCH

patch(string $pattern, $controller, array $options=[]) Add a route for the HTTP method PATCH

Returns

ICanBoogie\Routing\RouteCollection
public ICanBoogie\Routing\RouteCollection
# trace( )

trace(string $pattern, $controller, array $options=[]) Add a route for the HTTP method TRACE.

trace(string $pattern, $controller, array $options=[]) Add a route for the HTTP method TRACE.

Returns

ICanBoogie\Routing\RouteCollection

Constants summary

boolean TRUSTED_DEFINITIONS

Specify that the route definitions can be trusted.

Specify that the route definitions can be trusted.

# true
string DEFAULT_ROUTE_CLASS

Class name of the ICanBoogie\Routing\Route instances.

Class name of the ICanBoogie\Routing\Route instances.

# Route::class

Properties summary

protected array $routes

Route definitions.

Route definitions.

# []
protected ICanBoogie\Routing\Route[] $instances

Route instances.

Route instances.

# []
ICanBoogie/Routing master API documentation generated by ApiGen