Filter chain for string inflection

package Default
inherited_from \Zend\Filter\AbstractFilter

 Methods

Constructor

__construct(string|array|\Traversable $options = null

Parameters

$options

stringarray\Traversable

Options to set

Invoke filter as a command

__invoke(mixed $value) : mixed
Inherited

Proxies to \filter()

Parameters

$value

mixed

Exceptions

\Zend\Filter\Exception\ExceptionInterface If filtering $value is impossible

Returns

mixed

Add a filter rule for a spec

addFilterRule(mixed $spec, mixed $ruleSet) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

Parameters

$spec

mixed

$ruleSet

mixed

Returns

\Zend\Filter\Inflector

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' );

fluent This method is part of a fluent interface and will return the same instance

Parameters

$rules

array

Returns

\Zend\Filter\Inflector

Clears the rules currently in the inflector

clearRules() : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

Returns

\Zend\Filter\Inflector

Inflect

filter(string|array $source) : string

Parameters

$source

stringarray

Exceptions

\Zend\Filter\Exception\RuntimeException

Returns

string

Retrieve options representing object state

getOptions() : array
Inherited

Returns

array

Retrieve plugin manager

getPluginManager() : \Zend\Filter\FilterPluginManager

Returns

\Zend\Filter\FilterPluginManager

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

getRule(string $spec, integer $index) : \Zend\Filter\FilterInterface | false

Parameters

$spec

string

$index

integer

Returns

\Zend\Filter\FilterInterfacefalse

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

hasPcreUnicodeSupport()

hasPcreUnicodeSupport() : boolean
InheritedStatic
deprecated Since 2.1.0

Returns

boolean

Will exceptions be thrown?

isThrowTargetExceptionsOn() : boolean

Returns

boolean

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\FilterInterface $ruleSet) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

Parameters

$spec

string

$ruleSet

arraystring\Zend\Filter\FilterInterface

Returns

\Zend\Filter\Inflector

Set options

setOptions(array|\Traversable $options) : \Zend\Filter\Inflector
inherited_from \Zend\Filter\AbstractFilter::setOptions()
fluent This method is part of a fluent interface and will return the same instance

Parameters

$options

array\Traversable

Returns

\Zend\Filter\Inflector

setOptions()

setOptions(array|\Traversable $options) : \Zend\Filter\Inflector
Inherited
fluent This method is part of a fluent interface and will return the same instance

Parameters

$options

array\Traversable

Exceptions

\Zend\Filter\Exception\InvalidArgumentException

Returns

\Zend\Filter\Inflector

Set plugin manager

setPluginManager(\Zend\Filter\FilterPluginManager $manager) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

Parameters

$manager

\Zend\Filter\FilterPluginManager

Returns

\Zend\Filter\Inflector

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

setRules(array $rules) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

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
fluent This method is part of a fluent interface and will return the same instance

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.

fluent This method is part of a fluent interface and will return the same instance

Parameters

$name

string

$reference

mixed

Returns

\Zend\Filter\Inflector

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

setTarget(string $target) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

Parameters

$target

string

Returns

\Zend\Filter\Inflector

Set Target Reference

setTargetReference(string $target) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

Parameters

$target

string

Returns

\Zend\Filter\Inflector

Set the Target Replacement Identifier, by default ':'

setTargetReplacementIdentifier(string $targetReplacementIdentifier) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

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(boolean $throwTargetExceptionsOn) : \Zend\Filter\Inflector
fluent This method is part of a fluent interface and will return the same instance

Parameters

$throwTargetExceptionsOn

boolean

Returns

\Zend\Filter\Inflector

Resolve named filters and convert them to filter objects.

_getRule(string $rule) : \Zend\Filter\FilterInterface

Parameters

$rule

string

Returns

\Zend\Filter\FilterInterface

Normalize spec string

_normalizeSpec(string $spec) : string

Parameters

$spec

string

Returns

string

isOptions()

isOptions(mixed $options) : boolean
InheritedStatic

Parameters

$options

mixed

Returns

boolean

 Properties

 

Filter options

$options : array

Default

array()
 

$pluginManager

$pluginManager : \Zend\Filter\FilterPluginManager

Default

null
 

$rules

$rules : array

Default

array()
 

$target

$target : string

Default

null
 

$targetReplacementIdentifier

$targetReplacementIdentifier : string

Default

':'
 

$throwTargetExceptionsOn

$throwTargetExceptionsOn : boolean

Default

true