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

Public Member Functions

 __construct (Array $args=array())
 
 getFilterArgument ($name)
 
 getFilterArguments ()
 
 filter ($string=null)
 

Protected Member Functions

 _checkArguments ()
 
 getArguments ()
 

Protected Attributes

 $arguments = array()
 

Private Member Functions

 setFilterArguments (Array $args=array())
 

Private Attributes

 $filterArguments = array()
 

Detailed Description

Definition at line 62 of file Abstract.php.

Constructor & Destructor Documentation

Hoa_Filter_Abstract::__construct ( Array  $args = array())

Set the needed arguments.

public

Parameters
array$argsThe arguments of the filter.
Returns
void
Exceptions
Hoa_Filter_Exception

Definition at line 88 of file Abstract.php.

88  {
89 
90  $this->setFilterArguments($args);
91  }
setFilterArguments(Array $args=array())
Definition: Abstract.php:128

Here is the call graph for this function:

Member Function Documentation

Hoa_Filter_Abstract::_checkArguments ( )
protected

Check arguments of the filter.

protected

Returns
bool
Exceptions
Hoa_Filter_Exception

Definition at line 100 of file Abstract.php.

100  {
101 
102  $needed = array();
103  $args = $this->getFilterArguments();
104 
105  foreach($this->getArguments() as $name => $label)
106  if(!isset($args[$name]))
107  $needed[] = $name . ' : ' . $label;
108 
109  if(empty($needed))
110  return true;
111 
112  $message = get_class($this) . ' needs parameters :' . "\n - " .
113  implode("\n" . ' - ', $needed);
114 
115  throw new Hoa_Filter_Exception($message, 0);
116 
117  return false;
118  }

Here is the call graph for this function:

Here is the caller graph for this function:

Hoa_Filter_Abstract::filter (   $string = null)
abstract

Force to implement filter method.

public

Parameters
string$dataData to filter.
Returns
bool
Hoa_Filter_Abstract::getArguments ( )
protected

Get needed arguments.

protected

Returns
array

Definition at line 173 of file Abstract.php.

173  {
174 
175  return $this->arguments;
176  }

Here is the caller graph for this function:

Hoa_Filter_Abstract::getFilterArgument (   $name)

Get an argument of the filter.

public

Parameters
string$argThe argument name.
Returns
mixed
Exceptions
Hoa_Filter_Exception

Definition at line 146 of file Abstract.php.

146  {
147 
148  if( null !== $this->filterArguments[$name]
149  && !isset($this->filterArguments[$name]))
150  throw new Hoa_Filter_Exception(
151  'The argument %s does not exit.', 1, $name);
152 
153  return $this->filterArguments[$name];
154  }

Here is the caller graph for this function:

Hoa_Filter_Abstract::getFilterArguments ( )

Get arguments of the filter.

public

Returns
array

Definition at line 162 of file Abstract.php.

162  {
163 
164  return $this->filterArguments;
165  }

Here is the caller graph for this function:

Hoa_Filter_Abstract::setFilterArguments ( Array  $args = array())
private

Set arguments of the filter.

private

Parameters
array$argsArguments of the filter.
Returns
array
Exceptions
Hoa_Filter_Exception

Definition at line 128 of file Abstract.php.

128  {
129 
130  $old = $this->filterArguments;
131  $this->filterArguments = $args;
132 
133  $this->_checkArguments();
134 
135  return $old;
136  }

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Hoa_Filter_Abstract::$arguments = array()
protected

Definition at line 69 of file Abstract.php.

Hoa_Filter_Abstract::$filterArguments = array()
private

Definition at line 76 of file Abstract.php.


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