com\setasign\SetaFramework\Router\Route

File Class Route File

File: /SetaFramework/src/Router/Route/File.php

Class hierarchy

Implements

Summary

Properties

$defaultValues

protected array<string, mixed> File::$defaultValues

$file

protected string File::$file

$logger

protected ?\Psr\Log\LoggerInterface File::$logger

$requestPathPrefix

protected ?string File::$requestPathPrefix

Methods

__construct()

public File::__construct (
string $file,
array<string, mixed> $defaultValues = array ( ),
?string $requestPathPrefix = null
)

Constructor

The File Route match if you try to call a special file ($file).

If the requestPathPrefix doesn't match the route will fail.

Parameters
$file : string

Filename with path, exclude the requestPathPrefix

$defaultValues : array<string, mixed>
 
$requestPathPrefix : ?string
 

match()

public File::match (
\Psr\Http\Message\RequestInterface $request
): ?array

Checks whether this route matches to the request

Parameters
$request : \Psr\Http\Message\RequestInterface
 
Return Values

Returns associative array(without any numeric key) with values or NULL if the route not match

Exceptions

Throws \com\setasign\SetaFramework\Router\RouteException If $request is no server request

setDefaultValue()

public File::setDefaultValue (
string $key,
mixed $value
): void

Sets a key of the defaultValues array

Parameters
$key : string

The key shouldn't be a natural number

$value : mixed
 

setDefaultValues()

public File::setDefaultValues (
array<string, mixed> $defaultValues
): void

Overwrites the defaultValues array

Parameters
$defaultValues : array<string, mixed>

The keys of this array shouldn't be natural numbers

setLogger()

public File::setLogger (
\Psr\Log\LoggerInterface $logger
): void

Sets a logger instance on the object.

Parameters
$logger : \Psr\Log\LoggerInterface