Filter/Inflector.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
-
New BSD License
- Package
- Zend_Filter
- Version
- $Id: Inflector.php 24593 2012-01-05 20:35:02Z matthew $
Package: Zend\FilterFilter chain for string inflection
- Implements
- \Zend_Filter_Interface
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
-
New BSD License
Properties
Methods



__construct(string | array $options = null) : void
Parameters
Name |
Type |
Description |
$options |
string | array |
Options to set |



_getRule(string $rule) : \Zend_Filter_Interface
Resolve named filters and convert them to filter objects.
Parameters
Name |
Type |
Description |
$rule |
string |
|
Returns



addFilterPrefixPath(string $prefix, string $path) : \Zend_Filter_Inflector
Convienence method to add prefix and path to PluginLoader
Parameters
Name |
Type |
Description |
$prefix |
string |
|
$path |
string |
|
Returns



addFilterRule(mixed $spec, mixed $ruleSet) : void
Add a filter rule for a spec
Parameters
Name |
Type |
Description |
$spec |
mixed |
|
$ruleSet |
mixed |
|



addRules( $rules) : \Zend_Filter_Inflector
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'
);
Parameters
Name |
Type |
Description |
$rules |
|
array |
Returns



getRule(string $spec, int $index) : \Zend_Filter_Interface | false
getRule() returns a rule set by setFilterRule(), a numeric index must be provided
Parameters
Name |
Type |
Description |
$spec |
string |
|
$index |
int |
|
Returns



setFilterRule(string $spec, array | string | \Zend_Filter_Interface $ruleSet) : \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.
Parameters
Returns



setRules(array $rules) : \Zend_Filter_Inflector
SetRules() is the same as calling addRules() with the exception that it
clears the rules before adding them.
Parameters
Name |
Type |
Description |
$rules |
array |
|
Returns



setStaticRule(string $name, string $value) : \Zend_Filter_Inflector
Set a static rule for a spec.
This is a single string value
Parameters
Name |
Type |
Description |
$name |
string |
|
$value |
string |
|
Returns



setStaticRuleReference(string $name, mixed $reference) : \Zend_Filter_Inflector
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.
Parameters
Name |
Type |
Description |
$name |
string |
|
$reference |
mixed |
|
Returns



setTarget( $target) : \Zend_Filter_Inflector
Set a Target
ex: 'scripts/:controller/:action.:suffix'
Parameters
Name |
Type |
Description |
$target |
|
string |
Returns



setTargetReplacementIdentifier(string $targetReplacementIdentifier) : \Zend_Filter_Inflector
Set the Target Replacement Identifier, by default ':'
Parameters
Name |
Type |
Description |
$targetReplacementIdentifier |
string |
|
Returns



setThrowTargetExceptionsOn( $throwTargetExceptionsOn) : \Zend_Filter_Inflector
Set Whether or not the inflector should throw an exception when a replacement
identifier is still found within an inflected target.
Parameters
Name |
Type |
Description |
$throwTargetExceptionsOn |
|
|
Returns