Class Inflector

Summary

Fully Qualified Name: Zend\Filter\Inflector
Extends: AbstractFilter

Description

Filter chain for string inflection

Methods

Name Description Defined By
__construct() Constructor Inflector
__invoke() Invoke filter as a command AbstractFilter
addFilterRule() Add a filter rule for a spec Inflector
addRules() Multi-call to setting filter rules. Inflector
clearRules() Clears the rules currently in the inflector Inflector
filter() Inflect Inflector
getOptions() Retrieve options representing object state AbstractFilter
getPluginManager() Retrieve plugin manager Inflector
getRule() Returns a rule set by setFilterRule(), a numeric index must be provided Inflector
getRules() Get rules Inflector
getTarget() Retrieve target Inflector
getTargetReplacementIdentifier() Get Target Replacement Identifier Inflector
hasPcreUnicodeSupport() AbstractFilter
isThrowTargetExceptionsOn() Will exceptions be thrown? Inflector
setFilterRule() Set a filtering rule for a spec. $ruleSet can be a string, Filter object or an array of strings or filter objects. Inflector
setOptions() Set options Inflector
setPluginManager() Set plugin manager Inflector
setRules() Is the same as calling addRules() with the exception that it clears the rules before adding them. Inflector
setStaticRule() Set a static rule for a spec. This is a single string value Inflector
setStaticRuleReference() Set Static Rule Reference. Inflector
setTarget() Set a Target ex: 'scripts/:controller/:action.:suffix' Inflector
setTargetReference() Set Target Reference Inflector
setTargetReplacementIdentifier() Set the Target Replacement Identifier, by default ':' Inflector
setThrowTargetExceptionsOn() Set Whether or not the inflector should throw an exception when a replacement identifier is still found within an inflected target. Inflector

Method Details

__construct()

Constructor

Parameter Name Type Description
$options string|array|\Traversable Options

Returns:

__invoke()

Invoke filter as a command

Proxies to {@link filter()}

Parameter Name Type Description
$value mixed

Returns: mixed

addFilterRule()

Add a filter rule for a spec

Parameter Name Type Description
$spec mixed
$ruleSet mixed

Returns: self

addRules()

Multi-call to setting filter rules.

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'
);
Parameter Name Type Description
$rules array

Returns: self

clearRules()

Clears the rules currently in the inflector

Returns: self

filter()

Inflect

Parameter Name Type Description
$source string|array

Returns: string

getOptions()

Retrieve options representing object state

Returns: array

getPluginManager()

Retrieve plugin manager

Returns: \FilterPluginManager

getRule()

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

Parameter Name Type Description
$spec string
$index int

Returns: \FilterInterface|bool

getRules()

Get rules

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

Parameter Name Type Description
$spec string

Returns: array|bool

getTarget()

Retrieve target

Returns: string

getTargetReplacementIdentifier()

Get Target Replacement Identifier

Returns: string

hasPcreUnicodeSupport()

Returns: bool

isThrowTargetExceptionsOn()

Will exceptions be thrown?

Returns: bool

setFilterRule()

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

Parameter Name Type Description
$spec string
$ruleSet array|string|\Zend\Filter\FilterInterface

Returns: self

setOptions()

Set options

Parameter Name Type Description
$options array|\Traversable

Returns: self

setPluginManager()

Set plugin manager

Parameter Name Type Description
$manager \FilterPluginManager

Returns: self

setRules()

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

Parameter Name Type Description
$rules array

Returns: self

setStaticRule()

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

Parameter Name Type Description
$name string
$value string

Returns: self

setStaticRuleReference()

Set Static Rule Reference.

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.

Parameter Name Type Description
$name string
$reference mixed

Returns: self

setTarget()

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

Parameter Name Type Description
$target string

Returns: self

setTargetReference()

Set Target Reference

Parameter Name Type Description
$target string

Returns: self

setTargetReplacementIdentifier()

Set the Target Replacement Identifier, by default ':'

Parameter Name Type Description
$targetReplacementIdentifier string

Returns: self

setThrowTargetExceptionsOn()

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

Parameter Name Type Description
$throwTargetExceptionsOn bool

Returns: self

Top