Filter/Inflector.php

Show: PublicProtectedPrivateinherited
Table of Contents
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 license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Filter  
Version
$Id$  

\Zend_Filter_Inflector

Package: Zend_Filter
Filter chain for string inflection
Implements
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected\Zend_Loader_PluginLoader_Interface $_pluginLoader = null
Default valuenullDetails
Type
\Zend_Loader_PluginLoader_Interface
>VPropertyprotectedarray $_rules = array()
Default valuearray()Details
Type
array
>VPropertyprotectedstring $_target = null
Default valuenullDetails
Type
string
>VPropertyprotectedstring $_targetReplacementIdentifier = ':'
Default value':'Details
Type
string
>VPropertyprotectedbool $_throwTargetExceptionsOn = true
Default valuetrueDetails
Type
bool

Methods

methodpublic__construct(string | array $options = null) : void

Constructor

Parameters
NameTypeDescription
$optionsstring | array

Options to set

methodprotected_getRule(string $rule) : \Zend_Filter_Interface

Resolve named filters and convert them to filter objects.

Parameters
NameTypeDescription
$rulestring
Returns
TypeDescription
\Zend_Filter_Interface
methodprotected_normalizeSpec(string $spec) : string

Normalize spec string

Parameters
NameTypeDescription
$specstring
Returns
TypeDescription
string
methodpublicaddFilterPrefixPath(string $prefix, string $path) : \Zend_Filter_Inflector

Convienence method to add prefix and path to PluginLoader

Parameters
NameTypeDescription
$prefixstring
$pathstring
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicaddFilterRule(mixed $spec, mixed $ruleSet) : void

Add a filter rule for a spec

Parameters
NameTypeDescription
$specmixed
$ruleSetmixed
methodpublicaddRules( $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
NameTypeDescription
$rules
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicclearRules() : \Zend_Filter_Inflector

ClearRules() clears the rules currently in the inflector

Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicfilter(string | array $source) : string

Inflect

Parameters
NameTypeDescription
$sourcestring | array
Returns
TypeDescription
string
methodpublicgetPluginLoader() : \Zend_Loader_PluginLoader_Interface

Retreive PluginLoader

methodpublicgetRule(string $spec, int $index) : \Zend_Filter_Interface | false

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

Parameters
NameTypeDescription
$specstring
$indexint
Returns
TypeDescription
\Zend_Filter_Interface | false
methodpublicgetRules(string $spec = null) : array | false

Get rules

By default, returns all rules. If a $spec is provided, will return those rules if found, false otherwise.
Parameters
NameTypeDescription
$specstring
Returns
TypeDescription
array | false
methodpublicgetTarget() : string

Retrieve target

Returns
TypeDescription
string
methodpublicgetTargetReplacementIdentifier() : string

Get Target Replacement Identifier

Returns
TypeDescription
string
methodpublicisThrowTargetExceptionsOn() : bool

Will exceptions be thrown?

Returns
TypeDescription
bool
methodpublicsetConfig(\Zend_Config $config) : \Zend_Filter_Inflector

Use Zend_Config object to set object state

Parameters
NameTypeDescription
$config\Zend_Config
Returns
TypeDescription
\Zend_Filter_Inflector
Details
Deprecated
Use setOptions() instead  
methodpublicsetFilterRule(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
NameTypeDescription
$specstring
$ruleSetarray | string | \Zend_Filter_Interface
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetOptions(array $options) : \Zend_Filter_Inflector

Set options

Parameters
NameTypeDescription
$optionsarray
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetPluginLoader(\Zend_Loader_PluginLoader_Interface $pluginLoader) : \Zend_Filter_Inflector

Set PluginLoader

Parameters
NameTypeDescription
$pluginLoader\Zend_Loader_PluginLoader_Interface
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetRules(array $rules) : \Zend_Filter_Inflector

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

Parameters
NameTypeDescription
$rulesarray
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetStaticRule(string $name, string $value) : \Zend_Filter_Inflector

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

Parameters
NameTypeDescription
$namestring
$valuestring
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetStaticRuleReference(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
NameTypeDescription
$namestring
$referencemixed
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetTarget( $target) : \Zend_Filter_Inflector

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

Parameters
NameTypeDescription
$target
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetTargetReference(\reference $target) : \Zend_Filter_Inflector

Set Target Reference

Parameters
NameTypeDescription
$target\reference
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetTargetReplacementIdentifier(string $targetReplacementIdentifier) : \Zend_Filter_Inflector

Set the Target Replacement Identifier, by default ':'

Parameters
NameTypeDescription
$targetReplacementIdentifierstring
Returns
TypeDescription
\Zend_Filter_Inflector
methodpublicsetThrowTargetExceptionsOn( $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
NameTypeDescription
$throwTargetExceptionsOn
Returns
TypeDescription
\Zend_Filter_Inflector
Documentation was generated by phpDocumentor 2.2.0 .