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

Public Member Functions

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

Public Attributes

const KEEP = 0
 
const CAST = 1
 

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 62 of file Integer.php.

Member Function Documentation

Hoa_Filter_Integer::filter (   $string = null)

Apply an integer filter.

public

Parameters
string$stringThe string to filter.
Returns
string

Definition at line 96 of file Integer.php.

96  {
97 
98  if($this->getFilterArgument('operation') == self::CAST)
99  return (int) (string) $string;
100 
101  elseif($this->getFilterArgument('operation') == self::KEEP)
102  return preg_replace('#[^[:digit:]]#', '', (string) $string);
103 
104  return null;
105  }
getFilterArgument($name)
Definition: Abstract.php:146
if(true===function_exists('mb_internal_encoding')) if(true===function_exists('mb_regex_encoding')) return
Definition: Core.php:181

Here is the call graph for this function:

Member Data Documentation

Hoa_Filter_Integer::$arguments
protected
Initial value:
= array(
'operation' => 'specify the type of operation : KEEP (0) or CAST (1).'
)

Definition at line 83 of file Integer.php.

const Hoa_Filter_Integer::CAST = 1

Cast string to integer.

int

Definition at line 76 of file Integer.php.

const Hoa_Filter_Integer::KEEP = 0

Keep integer from string.

int

Definition at line 69 of file Integer.php.


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