StaticRangeMapper implements StaticMappableAspectInterface, Countable

Very useful for e.g. pagination or static range like "2011 ... 2030" for years.

Example: routeEnhancers: MyBlogPlugin: type: Extbase extension: BlogExample plugin: Pi1 routes: - { routePath: '/list/{paging_widget}', _controller: 'BlogExample::list', _arguments: {'paging_widget': '@widget_0/currentPage'}} - { routePath: '/glossary/{section}', _controller: 'BlogExample::glossary'} defaultController: 'BlogExample::list' requirements: paging_widget: '\d+' aspects: paging_widget: type: StaticRangeMapper start: '1' end: '100' section: type: StaticRangeMapper start: 'a' end: 'z'

Table of Contents

Interfaces

StaticMappableAspectInterface
Used for anything that has a fixed list of values mapped against route arguments.
Countable

Properties

$end  : string
$range  : array<string|int, string>
$settings  : array<string|int, mixed>
$start  : string

Methods

__construct()  : mixed
count()  : int
{@inheritdoc}
generate()  : string|null
resolve()  : string|null
applyNumericPrefix()  : array<string|int, string>
buildRange()  : array<string|int, string>
Builds range based on given settings and ensures each item is string.
respondWhenInRange()  : string|null

Properties

$range

protected array<string|int, string> $range

$settings

protected array<string|int, mixed> $settings

Methods

__construct()

public __construct(array<string|int, mixed> $settings) : mixed
Parameters
$settings : array<string|int, mixed>
Tags
throws
InvalidArgumentException

count()

{@inheritdoc}

public count() : int
Return values
int

generate()

public generate(string $value) : string|null
Parameters
$value : string
Return values
string|null

resolve()

public resolve(string $value) : string|null
Parameters
$value : string
Return values
string|null

applyNumericPrefix()

protected applyNumericPrefix(array<string|int, mixed> $range) : array<string|int, string>
Parameters
$range : array<string|int, mixed>
Return values
array<string|int, string>

buildRange()

Builds range based on given settings and ensures each item is string.

protected buildRange() : array<string|int, string>

The amount of items is limited to 1000 in order to avoid brute-force scenarios and the risk of cache-flooding.

In case that is not enough, creating a custom and more specific mapper is encouraged. Using high values that are not distinct exposes the site to the risk of cache-flooding.

Tags
throws
LengthException
Return values
array<string|int, string>

respondWhenInRange()

protected respondWhenInRange(string $value) : string|null
Parameters
$value : string
Return values
string|null

        
On this page

Search results