RuleRegularExpressionMatch Class Reference

List of all members.

Public Member Functions

 setNotFoundValue ($mixNotFoundedValue)
 getNotFoundedValue ()
 setRegularExpressionList ($arrRegularExpressionList)
 getRegularExpressionList ()
 addRegularExpression ($strRegularExpression, $mixValue=TRUE)
 found ($strName)
 isEmpty ()
 match ($strName)

Protected Attributes

 $arrRegularExpressionList = array()
 $arrValueList = array()
 $mixNotFoundedValue = FALSE


Detailed Description

Definition at line 12 of file RuleRegularExpressionMatch.class.php.


Member Function Documentation

addRegularExpression ( strRegularExpression,
mixValue = TRUE 
)

Add a class RegularExpression into the RegularExpression list

See also:
RuleMatchList->arrRegularExpressionList

RuleMatchList::setRegularExpressionList( String[] )

RuleMatchList::getRegularExpressionList()

Parameters:
string $strRegularExpression
Returns:
RuleRegularExpressionMacth me

Definition at line 101 of file RuleRegularExpressionMatch.class.php.

00102     {
00103         $intKeyRegularExpression = sizeof( $this->arrRegularExpressionList );
00104         $this->arrRegularExpressionList[ $intKeyRegularExpression ] = $strRegularExpression;
00105         $this->arrValueList[ $intKeyRegularExpression ] = $mixValue;
00106         return $this;
00107     }

found ( strName  ) 

Search the element into the array and returns true if founded and false if not

Parameters:
string $strName
Returns:
boolean

Definition at line 116 of file RuleRegularExpressionMatch.class.php.

00117     {
00118         foreach( $this->arrRegularExpressionList  as $intRegularExpressionKey => $strRegularExpression )
00119         {
00120             if( ereg( $strRegularExpression , $strName ) )
00121             {
00122                 return TRUE;
00123             }
00124         }
00125 
00126         return FALSE;
00127     }

getNotFoundedValue (  ) 

Get the not founded value

See also:
RuleRegularExpressionMatch->mixNotFoundedValue

RuleRegularExpressionMatch::setNotFoundValue( mixer )

Returns:
mixer $mixNotFoundedValue

Definition at line 61 of file RuleRegularExpressionMatch.class.php.

Referenced by match().

00062     {
00063         return $this->mixNotFoundedValue;
00064     }

getRegularExpressionList (  ) 

get the array with the RegularExpression list into the match

See also:
RuleMatchList->arrRegularExpressionList

RuleMatchList::setRegularExpressionList( String[] )

Returns:
String[] $arrRegularExpressionList

Definition at line 87 of file RuleRegularExpressionMatch.class.php.

00088     {
00089         return $this->arrRegularExpressionList;
00090     }

isEmpty (  ) 

Returns if the rule is empty

Returns:
boolean

Definition at line 134 of file RuleRegularExpressionMatch.class.php.

00135     {
00136         return ( sizeof( $this->arrRegularExpressionList ) == 0 );
00137     }

match ( strName  ) 

Match the string RegularExpression

Parameters:
string $strRegularExpression
Returns:
boolean

Definition at line 146 of file RuleRegularExpressionMatch.class.php.

References getNotFoundedValue().

00147     {
00148         $intKeyFound = FALSE;
00149         foreach( $this->arrRegularExpressionList  as $intRegularExpressionKey => $strRegularExpression )
00150         {
00151             if( ereg( $strRegularExpression , $strName ) )
00152             {
00153                 $intKeyFound = $intRegularExpressionKey;
00154             }
00155         }
00156         
00157         if( $intKeyFound !== FALSE )
00158         {
00159             $mixReturn = $this->arrValueList[ $intKeyFound ];
00160         }
00161         else
00162         {
00163             $mixReturn = $this->getNotFoundedValue();
00164         }
00165         return $mixReturn;
00166     }

setNotFoundValue ( mixNotFoundedValue  ) 

Set the not founded value

See also:
RuleRegularExpressionMatch->mixNotFoundedValue

RuleRegularExpressionMatch::getNotFoundValue()

Parameters:
mixer $mixNotFoundedValue
Returns:
RuleRegularExpressionMatch

Definition at line 48 of file RuleRegularExpressionMatch.class.php.

References $mixNotFoundedValue.

00049     {
00050         $this->mixNotFoundedValue = $mixNotFoundedValue;
00051         return $this;
00052     }

setRegularExpressionList ( arrRegularExpressionList  ) 

Set the array with the RegularExpression list into the match

See also:
RuleMatchList->arrRegularExpressionList

RuleMatchList::getRegularExpressionList()

Parameters:
String[] $arrRegularExpressionList
Returns:
RuleRegularExpressionMatch me

Definition at line 74 of file RuleRegularExpressionMatch.class.php.

References $arrRegularExpressionList.

00075     {
00076         $this->arrRegularExpressionList = $arrRegularExpressionList;
00077         return $this;
00078     }


Member Data Documentation

$arrRegularExpressionList = array() [protected]

Array with the string RegularExpression list what should be match

If is empty, anyone can enter.

string[]

Definition at line 22 of file RuleRegularExpressionMatch.class.php.

Referenced by setRegularExpressionList().

$arrValueList = array() [protected]

array with the values of the match if founded

array

Definition at line 29 of file RuleRegularExpressionMatch.class.php.

$mixNotFoundedValue = FALSE [protected]

value of the match when the element not be found into the RegularExpression list

Default: false
mixer

Definition at line 38 of file RuleRegularExpressionMatch.class.php.

Referenced by setNotFoundValue().


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

Generated on Thu Feb 3 03:55:04 2011 for CodeToDiagram by  doxygen 1.5.9