Filter chain for string inflection

category Zend
package Zend_Filter
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Constructor

__construct(string|array $options = null

Parameters

$options

stringarray

Options to set

Convienence method to add prefix and path to PluginLoader

addFilterPrefixPath(string $prefix, string $path) : \Zend_Filter_Inflector

Parameters

$prefix

string

$path

string

Returns

\Zend_Filter_Inflector

Add a filter rule for a spec

addFilterRule(mixed $spec, mixed $ruleSet) : void

Parameters

$spec

mixed

$ruleSet

mixed

AddRules(): multi-call to setting filter rules.

addRules(array $rules) : \Zend_Filter_Inflector

If prefixed with a ":" (colon), a filter rule will be added. If not prefixed, a static replacement will be added.

ex: array( ':controller' => array('CamelCaseToUnderscore','StringToLower'), ':action' => array('CamelCaseToUnderscore','StringToLower'), 'suffix' => 'phtml' );

Parameters

$rules

Returns

\Zend_Filter_Inflector

ClearRules() clears the rules currently in the inflector

clearRules() : \Zend_Filter_Inflector

Returns

\Zend_Filter_Inflector

Inflect

filter(string|array $source) : string
inherited_from \Zend_Filter_Interface::filter()

Parameters

$source

stringarray

Returns

string

Retreive PluginLoader

getPluginLoader() : \Zend_Loader_PluginLoader_Interface

Returns

\Zend_Loader_PluginLoader_Interface

getRule() returns a rule set by setFilterRule(), a numeric index must be provided

getRule(string $spec, integer $index) : \Zend_Filter_Interface | false

Parameters

$spec

string

$index

integer

Returns

\Zend_Filter_Interfacefalse

Get rules

getRules(string $spec = null) : array | false

By default, returns all rules. If a $spec is provided, will return those rules if found, false otherwise.

Parameters

$spec

string

Returns

arrayfalse

Retrieve target

getTarget() : string

Returns

string

Get Target Replacement Identifier

getTargetReplacementIdentifier() : string

Returns

string

Will exceptions be thrown?

isThrowTargetExceptionsOn() : boolean

Returns

boolean

Use Zend_Config object to set object state

setConfig(\Zend_Config $config) : \Zend_Filter_Inflector
deprecated Use setOptions() instead

Parameters

$config

\Zend_Config

Returns

\Zend_Filter_Inflector

Set a filtering rule for a spec. $ruleSet can be a string, Filter object or an array of strings or filter objects.

setFilterRule(string $spec, array|string|\Zend_Filter_Interface $ruleSet) : \Zend_Filter_Inflector

Parameters

$spec

string

$ruleSet

arraystring\Zend_Filter_Interface

Returns

\Zend_Filter_Inflector

Set options

setOptions(array $options) : \Zend_Filter_Inflector

Parameters

$options

array

Returns

\Zend_Filter_Inflector

Set PluginLoader

setPluginLoader(\Zend_Loader_PluginLoader_Interface $pluginLoader) : \Zend_Filter_Inflector

Parameters

$pluginLoader

\Zend_Loader_PluginLoader_Interface

Returns

\Zend_Filter_Inflector

SetRules() is the same as calling addRules() with the exception that it clears the rules before adding them.

setRules(array $rules) : \Zend_Filter_Inflector

Parameters

$rules

array

Returns

\Zend_Filter_Inflector

Set a static rule for a spec. This is a single string value

setStaticRule(string $name, string $value) : \Zend_Filter_Inflector

Parameters

$name

string

$value

string

Returns

\Zend_Filter_Inflector

Set Static Rule Reference.

setStaticRuleReference(string $name, mixed $reference) : \Zend_Filter_Inflector

This allows a consuming class to pass a property or variable in to be referenced when its time to build the output string from the target.

Parameters

$name

string

$reference

mixed

Returns

\Zend_Filter_Inflector

Set a Target ex: 'scripts/:controller/:action.:suffix'

setTarget($target) : \Zend_Filter_Inflector

Parameters

$target

Returns

\Zend_Filter_Inflector

Set Target Reference

setTargetReference(\reference $target) : \Zend_Filter_Inflector

Parameters

$target

\reference

Returns

\Zend_Filter_Inflector

Set the Target Replacement Identifier, by default ':'

setTargetReplacementIdentifier(string $targetReplacementIdentifier) : \Zend_Filter_Inflector

Parameters

$targetReplacementIdentifier

string

Returns

\Zend_Filter_Inflector

Set Whether or not the inflector should throw an exception when a replacement identifier is still found within an inflected target.

setThrowTargetExceptionsOn($throwTargetExceptionsOn) : \Zend_Filter_Inflector

Parameters

$throwTargetExceptionsOn

Returns

\Zend_Filter_Inflector

Resolve named filters and convert them to filter objects.

_getRule(string $rule) : \Zend_Filter_Interface

Parameters

$rule

string

Returns

\Zend_Filter_Interface

Normalize spec string

_normalizeSpec(string $spec) : string

Parameters

$spec

string

Returns

string

 Properties

 

$_pluginLoader

$_pluginLoader : \Zend_Loader_PluginLoader_Interface

Default

null
 

$_rules

$_rules : array

Default

array()
 

$_target

$_target : string

Default

null
 

$_targetReplacementIdentifier

$_targetReplacementIdentifier : string

Default

':'
 

$_throwTargetExceptionsOn

$_throwTargetExceptionsOn : boolean

Default

true