RuleMatch.class.php
Go to the documentation of this file.00001 <?php
00002
00011 class RuleMatch
00012 {
00016 protected $objNameRuleList = null;
00017
00022 protected $objRegexRuleList = null;
00023
00024 public function __construct()
00025 {
00026 $this->objNameRuleList = new RuleNameMatch();
00027 $this->objRegexRuleList = new RuleRegularExpressionMatch();
00028 }
00029
00037 public function addName( $strName , $mixValue = TRUE )
00038 {
00039 $this->objNameRuleList->addName( $strName , $mixValue );
00040 return $this;
00041 }
00042
00048 public function setNameList( $arrNameList )
00049 {
00050 $this->objNameRuleList->setNameList( $arrNameList );
00051 return $this;
00052 }
00053
00058 public function getNameList()
00059 {
00060 return $this->objNameRuleList->getNameList();
00061 }
00062
00063
00071 public function addRegularExpression( $strtRegularExpression , $mixValue = TRUE )
00072 {
00073 $this->objRegexRuleList->addRegularExpression( $strtRegularExpression , $mixValue );
00074 return $this;
00075 }
00076
00082 public function setRegularExpressionList( $arrRegularExpressionList )
00083 {
00084 $this->objRegexRuleList->setRegularExpressionList( $arrRegularExpressionList );
00085 return $this;
00086 }
00087
00093 public function getRegularExpressionList()
00094 {
00095 return $this->objRegexRuleList->getRegularExpressionList();
00096 }
00097
00104 public function setNotFoundValue( $mixNotFoundedValue )
00105 {
00106 $this->objNameRuleList->setNotFoundValue( $mixNotFoundedValue );
00107 $this->objRegexRuleList->setNotFoundValue( $mixNotFoundedValue );
00108 return $this;
00109 }
00110
00116 public function getNotFoundValue()
00117 {
00118 return $this->objNameRuleList->getNotFoundedValue();
00119 }
00120
00128 public function found( $strName )
00129 {
00130 if ( $this->objNameRuleList->found( $strName ) )
00131 {
00132 return TRUE;
00133 }
00134 else
00135 {
00136 return $this->objRegexRuleList->found( $strName );
00137 }
00138 }
00139
00145 public function isEmpty()
00146 {
00147 return ( $this->objNameRuleList->isEmpty() && $this->objRegexRuleList->isEmpty() );
00148 }
00149
00157 public function match( $strName )
00158 {
00159 if( $this->objNameRuleList->found( $strName ) )
00160 {
00161 return $this->objNameRuleList->match( $strName );
00162 }
00163 if( $this->objRegexRuleList->found($strRegularExpression))
00164 {
00165 return $this->objNameRuleList->match( $strName );
00166 }
00167 return $this->getNotFoundValue();
00168 }
00169 }
00170 ?>