Oihana PHP System

PutRoute extends MethodRoute

Represents a route definition and handles route creation and execution.

Table of Contents

Constants

CLAZZ  = 'clazz'
Array keys for route initialization
CONTROLLER_ID  = 'controllerID'
DEFAULT_OWNER_PATTERN  = '{owner:[0-9]+}'
Default owner pattern for numeric owner IDs
DEFAULT_PREFIX  = 'api'
Default API prefix for route names
DEFAULT_ROUTE_PATTERN  = '{id:[0-9]+}'
Default route pattern for numeric IDs
INTERNAL_METHOD  = \oihana\enums\http\HttpMethod::put
The default internal method name of the controller to invoke with this route.
METHOD  = 'method'
NAME  = 'name'
OWNER_PATTERN  = 'ownerPattern'
PATCH_PATTERN  = 'patchPattern'
PREFIX  = 'prefix'
PROPERTY  = 'property'
ROUTE  = 'route'
ROUTE_PATTERN  = 'routePattern'
ROUTES  = 'routes'
SUFFIX  = 'suffix'
VERBOSE  = 'verbose'

Properties

$container  : Container
The DI container reference.
$controllerID  : string|null
$logger  : LoggerInterface
$method  : string|mixed
The name of the method to call in the controller to invoke with this route.
$name  : string|null
$ownerPattern  : string|null
$prefix  : string
$property  : string
$route  : string|null
$routePattern  : string
$routes  : array<string|int, mixed>|null
$settings  : array<string|int, mixed>
$suffix  : string
$verbose  : bool
$app  : App

Methods

__construct()  : mixed
Creates a new MethodRoute instance.
__invoke()  : void
Called when a script tries to call the instance as a function.
__toString()  : string
Returns a String representation of the object.
cleanParams()  : array<string|int, mixed>
Removes null or empty string values from an array of parameters.
create()  : Route|null
Creates a new Route instance from a definition array or Route object.
dotify()  : string
Converts a route path from 'foo/bar' to 'foo.bar'.
execute()  : void
Executes a callable or an array of callables.
getName()  : string
Returns the fully qualified route name, including prefix and suffix.
getRoute()  : string
Returns the safe main route representation starting with '/'.

Constants

CLAZZ

Array keys for route initialization

public mixed CLAZZ = 'clazz'

CONTROLLER_ID

public mixed CONTROLLER_ID = 'controllerID'

DEFAULT_OWNER_PATTERN

Default owner pattern for numeric owner IDs

public mixed DEFAULT_OWNER_PATTERN = '{owner:[0-9]+}'

DEFAULT_PREFIX

Default API prefix for route names

public mixed DEFAULT_PREFIX = 'api'

DEFAULT_ROUTE_PATTERN

Default route pattern for numeric IDs

public mixed DEFAULT_ROUTE_PATTERN = '{id:[0-9]+}'

INTERNAL_METHOD

The default internal method name of the controller to invoke with this route.

public mixed INTERNAL_METHOD = \oihana\enums\http\HttpMethod::put

METHOD

public mixed METHOD = 'method'

NAME

public mixed NAME = 'name'

OWNER_PATTERN

public mixed OWNER_PATTERN = 'ownerPattern'

PATCH_PATTERN

public mixed PATCH_PATTERN = 'patchPattern'

PREFIX

public mixed PREFIX = 'prefix'

PROPERTY

public mixed PROPERTY = 'property'

ROUTE

public mixed ROUTE = 'route'

ROUTE_PATTERN

public mixed ROUTE_PATTERN = 'routePattern'

ROUTES

public mixed ROUTES = 'routes'

SUFFIX

public mixed SUFFIX = 'suffix'

VERBOSE

public mixed VERBOSE = 'verbose'

Properties

$container

The DI container reference.

public Container $container

$controllerID

public string|null $controllerID = null

Controller ID registered in DI container

$logger

public LoggerInterface $logger

Logger instance

$method

The name of the method to call in the controller to invoke with this route.

public string|mixed $method

$name

public string|null $name = null

Route name

$ownerPattern

public string|null $ownerPattern = self::DEFAULT_OWNER_PATTERN

Owner route pattern

$prefix

public string $prefix = self::DEFAULT_PREFIX

Route name prefix

$property

public string $property = \oihana\enums\Char::EMPTY

Property name in complex routes

$route

public string|null $route = null

Main route pattern

$routePattern

public string $routePattern = self::DEFAULT_ROUTE_PATTERN

Main route pattern regex

$routes

public array<string|int, mixed>|null $routes = null

Nested route definitions

$settings

public array<string|int, mixed> $settings

Initial settings passed to constructor

$suffix

public string $suffix = \oihana\enums\Char::EMPTY

Route name suffix

$verbose

public bool $verbose = true

Verbose mode flag

$app

protected App $app

Slim App instance

Methods

__construct()

Creates a new MethodRoute instance.

public __construct(Container $container[, array<string|int, mixed> $init = [] ]) : mixed
Parameters
$container : Container

The DI Container reference.

$init : array<string|int, mixed> = []

The optional settings object.

Tags
throws
DependencyException
throws
NotFoundException

__invoke()

Called when a script tries to call the instance as a function.

public __invoke() : void
Tags
throws
DependencyException
throws
NotFoundException

__toString()

Returns a String representation of the object.

public __toString() : string
Tags
throws
ReflectionException
Return values
string

A string representation of the object.

cleanParams()

Removes null or empty string values from an array of parameters.

public cleanParams([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameters to clean

Return values
array<string|int, mixed>

Filtered parameters

create()

Creates a new Route instance from a definition array or Route object.

public create(array<string|int, mixed>|Route|null $definition) : Route|null
Parameters
$definition : array<string|int, mixed>|Route|null

Route definition or existing Route

Return values
Route|null

The created Route instance or null if invalid

dotify()

Converts a route path from 'foo/bar' to 'foo.bar'.

public dotify(string $route) : string
Parameters
$route : string

Route path

Return values
string

Dotified route path

execute()

Executes a callable or an array of callables.

public execute(mixed $routes) : void
Parameters
$routes : mixed

Callable or array of callables

getName()

Returns the fully qualified route name, including prefix and suffix.

public getName() : string
Return values
string

Route name

getRoute()

Returns the safe main route representation starting with '/'.

public getRoute() : string
Return values
string

Route path


        
On this page

Search results