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

Public Member Functions

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

Protected Member Functions

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

Protected Attributes

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

Detailed Description

Definition at line 70 of file Filter.php.

Member Function Documentation

Hoa_Filter::addFilter (   $filters)

Add a filter.

public

Parameters
mixed$filtersThe filters.
Returns
void
Exceptions
Hoa_Filter_Exception

Definition at line 88 of file Filter.php.

88  {
89 
90  if(!is_array($filters))
91  $filters = array($filters => array());
92 
93  foreach($filters as $filter => $arguments) {
94 
95  if(is_int($filter)) {
96 
97  $filter = $arguments;
98  $arguments = array();
99  }
100 
101  if(is_array($filter)) {
102 
103  $arguments = current($filter);
104  $filter = key($filter);
105  }
106 
107  if(!is_array($arguments))
108  $arguments = array($arguments);
109 
110  $arguments = array($arguments);
111 
112  $filter = Hoa_Factory::get('Filter', $filter, $arguments);
113 
114  if(!($filter instanceof Hoa_Filter_Abstract))
115  throw new Hoa_Filter_Exception(
116  'The filter %s does not extend Hoa_Filter_Abstract.',
117  0, get_class($filter));
118 
119  if($this->filterExists(get_class($filter)))
120  throw new Hoa_Filter_Exception(
121  'The filter %s already exists.',
122  1, get_class($filter));
123 
124  $this->filters[get_class($filter)] = $filter;
125  }
126  }
filterExists($filter)
Definition: Filter.php:135

Here is the call graph for this function:

Hoa_Filter::filter (   $string = null)

Check if a data is valid.

public

Parameters
string$stringThe string to filter.
Returns
bool

Definition at line 158 of file Filter.php.

158  {
159 
160  foreach($this->getFilters() as $name => $filter)
161  $string = $filter->filter($string);
162 
163  return $string;
164  }
getFilters()
Definition: Filter.php:146

Here is the call graph for this function:

Hoa_Filter::filterExists (   $filter)

Check if a filter already exists or not.

public

Parameters
string$filterThe filter.
Returns
bool

Definition at line 135 of file Filter.php.

135  {
136 
137  return isset($this->filters[$filter]);
138  }

Here is the caller graph for this function:

Hoa_Filter::getFilters ( )
protected

Get filters.

protected

Returns
array

Definition at line 146 of file Filter.php.

146  {
147 
148  return $this->filters;
149  }

Here is the caller graph for this function:

Member Data Documentation

Hoa_Filter::$filters = array()
protected

Definition at line 77 of file Filter.php.


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