ICanBoogie
  • Documentation
  • API Reference
  • Routing 4.0.x
Namespaces
  • ICanBoogie
    • Routing
      • Controller
      • Route
      • RouteDispatcher
Classes
  • ClosureController
  • Controller
  • FormattedRoute
  • Helpers
  • Pattern
  • Route
  • RouteCollection
  • RouteDefinition
  • RouteDispatcher
  • RouteMaker
Interfaces
  • Exception
  • ToSlug
Exceptions
  • ActionNotDefined
  • ControllerNotDefined
  • PatternNotDefined
  • PatternRequiresValues
  • RouteNotDefined

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 __call( string $method, array $arguments ) : ICanBoogie\Routing\RouteCollection

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 add( array $definition, boolean $trusted_definition = false ) : ICanBoogie\Routing\RouteCollection

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 resource( string $name, string $controller, array $options = [] ) : array

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( void )

Implementation of

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

Implementation of

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

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 count( void ) : integer

Returns the number of routes in the collection.

Returns the number of routes in the collection.

Returns

integer

Implementation of

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

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 filter( callable $filter ) : ICanBoogie\Routing\RouteCollection

Returns a new collection with filtered routes.

Returns a new collection with filtered routes.

Parameters

$filter

Returns

ICanBoogie\Routing\RouteCollection

Magic methods summary

public any( void ) : ICanBoogie\Routing\RouteCollection

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 connect( void ) : ICanBoogie\Routing\RouteCollection

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 delete( void ) : ICanBoogie\Routing\RouteCollection

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 get( void ) : ICanBoogie\Routing\RouteCollection

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 head( void ) : ICanBoogie\Routing\RouteCollection

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 options( void ) : ICanBoogie\Routing\RouteCollection

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 post( void ) : ICanBoogie\Routing\RouteCollection

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 put( void ) : ICanBoogie\Routing\RouteCollection

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 patch( void ) : ICanBoogie\Routing\RouteCollection

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 trace( void ) : ICanBoogie\Routing\RouteCollection

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

TRUSTED_DEFINITIONS : boolean

Specify that the route definitions can be trusted.

Specify that the route definitions can be trusted.

true
DEFAULT_ROUTE_CLASS : string

Class name of the ICanBoogie\Routing\Route instances.

Class name of the ICanBoogie\Routing\Route instances.

Route::class

Properties summary

protected $routes : array

Route definitions.

Route definitions.

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

Route instances.

Route instances.

[]
Routing 4.0.x – Check on GitHub – API documentation generated by ApiGen