Overview

Packages

  • Pinoco
    • PAL

Classes

  • Pinoco
  • Pinoco_Delegate
  • Pinoco_DynamicVars
  • Pinoco_HttpRequestVars
  • Pinoco_List
  • Pinoco_MIMEType
  • Pinoco_NativeRenderer
  • Pinoco_NothingVars
  • Pinoco_NullRenderer
  • Pinoco_OptionalParam
  • Pinoco_Pagination
  • Pinoco_PDOStatementWrapper
  • Pinoco_PDOWrapper
  • Pinoco_Renderer
  • Pinoco_Router
  • Pinoco_TALRenderer
  • Pinoco_TestEnvironment
  • Pinoco_Validator
  • Pinoco_ValidatorContext
  • Pinoco_Vars

Interfaces

  • Pinoco_ArrayConvertible

Functions

  • __pinoco_autoload_impl
  • Overview
  • Package
  • Class
  • Tree

Class Pinoco_Router

Pattern matching router. This utility can be used on any phase of Pinoco runtime process.

$router = Pinoco::instance()->route();
$router->pass(array('', 'index.html',))
    ->on('list', function() use($self, $data) {
        // ...
    })
    ->on('show/{id}', function($id) use($self, $data) {
        // ...
    })
    ->on('POST:post', function() use($self, $data) {
        // ...
    })
    ->on('GET:post', array($this, 'forbidden'))
    ->on('*', array($this, 'notfound'));

Pattern rules:

'/index'            : Fixed route.
'index'             : Fixed route in relative path from current (_enter) hook.
'/show/{id}'        : Parametrized one. Such path elements are passed to handler.
'GET: /edit/{id}' or
'POST: /edit/{id}'  : Different HTTP methods can be different routes.
'*:*'               : Matches any patterns. Useful to be bound to Pinoco::notfound()  or forbidden().
Package: Pinoco
Copyright: Copyright 2010-2012, Hisateru Tanaka <tanakahisateru@gmail.com>
License: License (http://www.opensource.org/licenses/mit-license.php)
Author: Hisateru Tanaka <tanakahisateru@gmail.com>
Located at Pinoco/Router.php
Methods summary
public
# __construct( Pinoco $pinoco )

Constructor

Constructor

Parameters

$pinoco
Pinoco
$pinoco
public mixed
# on( string|array $route, callable $handler )

Routing rules which binds URI path to any callable.

Routing rules which binds URI path to any callable.

Specified handler is called immediately if the route matches. Please note that this method is not a definition but invoker.

Parameters

$route
string|array
$route
$handler
callable
$handler

Returns

mixed
$this
public mixed
# pass( string|array $route )

Specified route is ignored and delegated to the next script step. This method is useful to ignore matching patterns below. (e.g. ':')

Specified route is ignored and delegated to the next script step. This method is useful to ignore matching patterns below. (e.g. ':')

Parameters

$route
string|array
$route

Returns

mixed
$this
public boolean
# wasMatched( )

Returns which a matching router was found and handled or not.

Returns which a matching router was found and handled or not.

Returns

boolean
Properties summary
protected boolean $matched
#
Pinoco 0.8.0 Documentation API documentation generated by ApiGen 2.8.0