API Documentation

Zend/Filter/Inflector.php

Show: inherited
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-2012 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Filter  
Version
$Id: Inflector.php 24594 2012-01-05 21:27:01Z matthew $  

\Zend_Filter_Inflector

Package: Zend\Filter

Filter 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

Propertyprotected\Zend_Loader_PluginLoader_Interface  $_pluginLoader= 'null'

Default valuenullDetails
Type
\Zend_Loader_PluginLoader_Interface
Propertyprotectedarray  $_rules= 'array()'

Default valuearray()Details
Type
array
Propertyprotectedstring  $_target= 'null'

Default valuenullDetails
Type
string
Propertyprotectedstring  $_targetReplacementIdentifier= '':''

Default value':'Details
Type
string
Propertyprotectedbool  $_throwTargetExceptionsOn= 'true'

Default valuetrueDetails
Type
bool

Methods

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

Constructor

Parameters
Name Type Description
$options string|array

Options to set

methodprotected_getRule( string $rule ) : \Zend_Filter_Interface

Resolve named filters and convert them to filter objects.

Parameters
Name Type Description
$rule string
Returns
Type Description
\Zend_Filter_Interface
methodprotected_normalizeSpec( string $spec ) : string

Normalize spec string

Parameters
Name Type Description
$spec string
Returns
Type Description
string
methodpublicaddFilterPrefixPath( 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
Type Description
\Zend_Filter_Inflector
methodpublicaddFilterRule( mixed $spec, mixed $ruleSet ) : void

Add a filter rule for a spec

Parameters
Name Type Description
$spec mixed
$ruleSet mixed
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
Name Type Description
$rules

array

Returns
Type Description
\Zend_Filter_Inflector
methodpublicclearRules( ) : \Zend_Filter_Inflector

ClearRules() clears the rules currently in the inflector

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

Inflect

Parameters
Name Type Description
$source string|array
Returns
Type Description
string
methodpublicgetPluginLoader( ) : \Zend_Loader_PluginLoader_Interface

Retreive PluginLoader

Returns
Type Description
\Zend_Loader_PluginLoader_Interface
methodpublicgetRule( 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
Type Description
\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
Name Type Description
$spec string
Returns
Type Description
array|false
methodpublicgetTarget( ) : string

Retrieve target

Returns
Type Description
string
methodpublicgetTargetReplacementIdentifier( ) : string

Get Target Replacement Identifier

Returns
Type Description
string
methodpublicisThrowTargetExceptionsOn( ) : bool

Will exceptions be thrown?

Returns
Type Description
bool
methodpublicsetConfig( \Zend_Config $config ) : \Zend_Filter_Inflector

Use Zend_Config object to set object state

Parameters
Name Type Description
$config \Zend_Config
Returns
Type Description
\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
Name Type Description
$spec string
$ruleSet array|string|\Zend_Filter_Interface
Returns
Type Description
\Zend_Filter_Inflector
methodpublicsetOptions( array $options ) : \Zend_Filter_Inflector

Set options

Parameters
Name Type Description
$options array
Returns
Type Description
\Zend_Filter_Inflector
methodpublicsetPluginLoader( \Zend_Loader_PluginLoader_Interface $pluginLoader ) : \Zend_Filter_Inflector

Set PluginLoader

Parameters
Name Type Description
$pluginLoader \Zend_Loader_PluginLoader_Interface
Returns
Type Description
\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
Name Type Description
$rules array
Returns
Type Description
\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
Name Type Description
$name string
$value string
Returns
Type Description
\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
Name Type Description
$name string
$reference mixed
Returns
Type Description
\Zend_Filter_Inflector
methodpublicsetTarget(  $target ) : \Zend_Filter_Inflector

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

Parameters
Name Type Description
$target

string

Returns
Type Description
\Zend_Filter_Inflector
methodpublicsetTargetReference( \reference $target ) : \Zend_Filter_Inflector

Set Target Reference

Parameters
Name Type Description
$target \reference
Returns
Type Description
\Zend_Filter_Inflector
methodpublicsetTargetReplacementIdentifier( string $targetReplacementIdentifier ) : \Zend_Filter_Inflector

Set the Target Replacement Identifier, by default ':'

Parameters
Name Type Description
$targetReplacementIdentifier string
Returns
Type Description
\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
Name Type Description
$throwTargetExceptionsOn
Returns
Type Description
\Zend_Filter_Inflector
Documentation was generated by DocBlox 0.15.1.