Hoa central
Public Member Functions | Protected Attributes | List of all members
Hoa_Filter_Array Class Reference
Inheritance diagram for Hoa_Filter_Array:

Public Member Functions

 filter ($string=null)
 
- Public Member Functions inherited from Hoa_Filter_Abstract
 __construct (Array $args=array())
 
 getFilterArgument ($name)
 
 getFilterArguments ()
 
 filter ($string=null)
 

Protected Attributes

 $arguments
 
- Protected Attributes inherited from Hoa_Filter_Abstract
 $arguments = array()
 

Additional Inherited Members

- Protected Member Functions inherited from Hoa_Filter_Abstract
 _checkArguments ()
 
 getArguments ()
 

Detailed Description

Definition at line 67 of file Array.php.

Member Function Documentation

Hoa_Filter_Array::filter (   $string = null)

Apply filters. In this case, the string must be an array. If it is not an array, the string will be convert to an array.

public

Parameters
string$stringThe string to filter.
Returns
array
Exceptions
Hoa_Filter_Exception

Definition at line 90 of file Array.php.

90  {
91 
92  if(!is_array($string))
93  $string = array($string);
94 
95  $filters = $this->getFilterArgument('filters');
96  $lastFilter = current($filters);
97 
98  foreach($filters as $key => &$filter)
99  if($filter === null)
100  $filter = $lastFilter;
101  else
102  $lastFilter = $filters[$key];
103 
104  foreach($string as $key => &$value) {
105 
106  $add = new Hoa_Filter();
107 
108  if(!isset($filters[$key]))
109  if(isset($filters['*']))
110  $add->addFilter($filters['*']);
111  else
112  continue;
113  else
114  $add->addFilter($filters[$key]);
115 
116  $value = $add->filter($value);
117  $add = null;
118  }
119 
120  return $string;
121  }
getFilterArgument($name)
Definition: Abstract.php:146

Here is the call graph for this function:

Member Data Documentation

Hoa_Filter_Array::$arguments
protected
Initial value:
= array(
'filters' => 'specify an associative array of key => filter to apply.'
)

Definition at line 74 of file Array.php.


The documentation for this class was generated from the following file: