Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • Controller
  • Dispatcher
  • Helpers
  • Pattern

Functions

  • contextualize
  • decontextualize

Class Pattern

Representation of a route pattern.

<?php

use ICanBoogie\Routing\Pattern;

$pattern = Pattern::from("/blog/<year:\d{4}>-<month:\d{2}>-:slug.html");
echo $pattern;       // "/blog/<year:\d{4}>-<month:\d{2}>-:slug.html"

$pathname = $pattern->format(array('year' => "2013", 'month' => "07", 'slug' => "test-is-a-test"));
echo $pathname;      // "/blog/2013-07-this-is-a-test.html"

$matching = $pattern->match($pathname, $captured);

var_dump($matching); // true
var_dump($captured); // array('year' => "2013", 'month' => "07", 'slug' => "test-is-a-test")
Namespace: ICanBoogie\Routing
Located at vendor/icanboogie/routing/lib/pattern.php

Methods summary

public static boolean
# is_pattern( string $pattern )

Checks if the given string is a route pattern.

Checks if the given string is a route pattern.

Parameters

$pattern
string
$pattern

Returns

boolean
true if the given pattern is a route pattern, false otherwise.
public static ICanBoogie\Pattern
# from( mixed $pattern )

Creates a ICanBoogie\Routing\Pattern instance from the specified pattern.

Creates a ICanBoogie\Routing\Pattern instance from the specified pattern.

Parameters

$pattern
mixed
$pattern

Returns

ICanBoogie\Pattern
protected
# __construct( string $pattern )

Initializes the ICanBoogie\Routing\Pattern::$pattern, ICanBoogie\Routing\Pattern::$interleaved, ICanBoogie\Routing\Pattern::$params and ICanBoogie\Routing\Pattern::$regex properties.

Initializes the ICanBoogie\Routing\Pattern::$pattern, ICanBoogie\Routing\Pattern::$interleaved, ICanBoogie\Routing\Pattern::$params and ICanBoogie\Routing\Pattern::$regex properties.

Parameters

$pattern
string
$pattern A route pattern.
public string
# __toString( )

Returns the route pattern specified during construct.

Returns the route pattern specified during construct.

Returns

string
public
# __get( mixed $property )
public string
# format( mixed $values = null )

Formats a pattern with the specified values.

Formats a pattern with the specified values.

Parameters

$values
mixed
$values The values to format the pattern, either as an array or an object.

Returns

string
public boolean
# match( string $pathname, array & $captured = null )

Checks if a pathname matches the pattern.

Checks if a pathname matches the pattern.

Parameters

$pathname
string
$pathname The pathname.
$captured
array
$captured The parameters captured from the pathname.

Returns

boolean
true if the pathname matches the pattern, false otherwise.

Magic methods summary

Properties summary

protected string $pattern
#

Pattern.

Pattern.

protected array $interleaved
#

Interleaved pattern.

Interleaved pattern.

protected array $params
#

Params of the pattern.

Params of the pattern.

protected string $regex
#

Regex of the pattern.

Regex of the pattern.

Magic properties

public read-only string $pattern
#

The pattern.

The pattern.

public read-only array $interleaved
#

The interleaved parts of the pattern.

The interleaved parts of the pattern.

public read-only array $params
#

The names of the pattern params.

The names of the pattern params.

public read-only string $regex
#

The regex of the pattern.

The regex of the pattern.

Autodoc API documentation generated by ApiGen 2.8.0