Documentation

MemoizingInflector
in package
implements InflectorInterface

Decorator used to add memoization to previously inflected words

Table of Contents

Interfaces

InflectorInterface
Inflector interface used to convert the casing of words

Properties

$cache  : array<string|int, mixed>
$decoratedInflector  : InflectorInterface
$maxCacheSize  : int

Methods

__construct()  : mixed
camel()  : string
Converts strings from snake_case to upper CamelCase
snake()  : string
Converts strings from camel case to snake case (e.g. CamelCase camel_case).
pruneCache()  : mixed
Prune one of the named caches by removing 20% of the cache if it is full

Properties

$cache

protected array<string|int, mixed> $cache = array('snake' => array(), 'camel' => array())

Array of cached inflections

Methods

camel()

Converts strings from snake_case to upper CamelCase

public camel(string $word) : string
Parameters
$word : string

Value to convert into upper CamelCase

Return values
string

snake()

Converts strings from camel case to snake case (e.g. CamelCase camel_case).

public snake(mixed $word) : string
Parameters
$word : mixed

Word to convert to snake case

Return values
string

pruneCache()

Prune one of the named caches by removing 20% of the cache if it is full

protected pruneCache(string $cache) : mixed
Parameters
$cache : string

Type of cache to prune


        
On this page

Search results