Open Journal Systems  3.3.0
Guzzle\Inflection\MemoizingInflector Class Reference
Inheritance diagram for Guzzle\Inflection\MemoizingInflector:
Guzzle\Inflection\InflectorInterface

Public Member Functions

 __construct (InflectorInterface $inflector, $maxCacheSize=500)
 
 camel ($word)
 
 snake ($word)
 

Protected Member Functions

 pruneCache ($cache)
 

Protected Attributes

 $cache
 
 $decoratedInflector
 
 $maxCacheSize
 

Detailed Description

Decorator used to add memoization to previously inflected words

Definition at line 8 of file MemoizingInflector.php.

Constructor & Destructor Documentation

◆ __construct()

Guzzle\Inflection\MemoizingInflector::__construct ( InflectorInterface  $inflector,
  $maxCacheSize = 500 
)
Parameters
InflectorInterface$inflectorInflector being decorated
int$maxCacheSizeMaximum number of cached items to hold per cache

Definition at line 35 of file MemoizingInflector.php.

References Guzzle\Inflection\MemoizingInflector\$maxCacheSize.

Member Function Documentation

◆ camel()

Guzzle\Inflection\MemoizingInflector::camel (   $word)

Converts strings from snake_case to upper CamelCase

Parameters
string$wordValue to convert into upper CamelCase
Returns
string

Implements Guzzle\Inflection\InflectorInterface.

Definition at line 58 of file MemoizingInflector.php.

References Guzzle\Inflection\MemoizingInflector\pruneCache().

◆ pruneCache()

Guzzle\Inflection\MemoizingInflector::pruneCache (   $cache)
protected

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

Parameters
string$cacheType of cache to prune

Definition at line 73 of file MemoizingInflector.php.

References Guzzle\Inflection\MemoizingInflector\$cache.

Referenced by Guzzle\Inflection\MemoizingInflector\camel(), and Guzzle\Inflection\MemoizingInflector\snake().

◆ snake()

Guzzle\Inflection\MemoizingInflector::snake (   $word)

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

Parameters
string$wordWord to convert to snake case
Returns
string

Implements Guzzle\Inflection\InflectorInterface.

Definition at line 41 of file MemoizingInflector.php.

References Guzzle\Inflection\MemoizingInflector\pruneCache().

Field Documentation

◆ $cache

array Guzzle\Inflection\MemoizingInflector::$cache
protected
Initial value:
= array(
'snake' => array(),
'camel' => array()
)

Array of cached inflections

Definition at line 14 of file MemoizingInflector.php.

Referenced by Guzzle\Inflection\MemoizingInflector\pruneCache().

◆ $decoratedInflector

InflectorInterface Guzzle\Inflection\MemoizingInflector::$decoratedInflector
protected

Decorated inflector

Definition at line 29 of file MemoizingInflector.php.

◆ $maxCacheSize

int Guzzle\Inflection\MemoizingInflector::$maxCacheSize
protected

Max entries per cache

Definition at line 23 of file MemoizingInflector.php.

Referenced by Guzzle\Inflection\MemoizingInflector\__construct().


The documentation for this class was generated from the following file: