RuleNameMatch.class.php

Go to the documentation of this file.
00001 <?php
00002 
00012 class RuleNameMatch
00013 {
00022     protected $arrNameList = array();
00023 
00029     protected $arrValueList = array();
00030 
00038     protected $mixNotFoundedValue = FALSE;
00039 
00048     public function setNotFoundValue( $mixNotFoundedValue )
00049     {
00050         $this->mixNotFoundedValue = $mixNotFoundedValue;
00051         return $this;
00052     }
00053 
00061     public function getNotFoundedValue()
00062     {
00063         return $this->mixNotFoundedValue;
00064     }
00065 
00074     public function setNameList( $arrNameList )
00075     {
00076         $this->arrNameList = $arrNameList;
00077         return $this;
00078     }
00079 
00087     public function getNameList()
00088     {
00089         return $this->arrNameList;
00090     }
00091 
00101     public function addName( $strName , $mixValue = TRUE )
00102     {
00103         $intKeyName = sizeof( $this->arrNameList );
00104         $this->arrNameList[ $intKeyName ] = $strName;
00105         $this->arrValueList[ $intKeyName ] = $mixValue;
00106         return $this;
00107     }
00108 
00116     public function found( $strName )
00117     {
00118         if ( in_array( $strName , $this->arrNameList ) )
00119         {
00120             return TRUE;
00121         }
00122         else
00123         {
00124             return FALSE;
00125         }
00126     }
00127 
00133     public function isEmpty()
00134     {
00135         return ( sizeof( $this->arrNameList ) == 0 );
00136     }
00137 
00144     public function match( $strName )
00145     {
00146         $intKeyFound = array_search( $strName , $this->arrNameList );
00147         if( $intKeyFound !== FALSE )
00148         {
00149             $mixReturn = $this->arrValueList[ $intKeyFound ];
00150         }
00151         else
00152         {
00153             $mixReturn = $this->getNotFoundedValue();
00154         }
00155         return $mixReturn;
00156     }
00157 }
00158 ?>

Generated on Sat Apr 7 14:19:10 2012 for CodeToDiagram by  doxygen 1.5.9