00001 <?php 00032 class MatchGroup implements MatchInterface 00033 { 00039 protected $objMatchName; 00040 00046 protected $objMatchRegularExpression; 00047 00054 protected $objNotFoundValue = false; 00055 00059 public function __construct() 00060 { 00061 $this->objMatchName = new MatchName(); 00062 $this->objMatchRegularExpression = new MatchRegularExpression(); 00063 } 00064 00071 public function setMatchName( MatchName $objMatchName ) 00072 { 00073 $this->objMatchName = $objMatchName; 00074 return $this; 00075 } 00076 00082 public function getMatchName() 00083 { 00084 return $this->objMatchName; 00085 } 00086 00093 public function setMatchRegularExpression( MatchRegularExpression $objMatchName ) 00094 { 00095 $this->objMatchRegularExpression = $objMatchRegularExpression; 00096 return $this; 00097 } 00098 00104 public function getMatchRegularExpression() 00105 { 00106 return $this->objMatchRegularExpression; 00107 } 00108 00115 public function setNotFoundValue( $objNotFoundValue ) 00116 { 00117 $this->objNotFoundValue = $objNotFoundValue; 00118 $this->getMatchName()->setNotFoundValue( $objNotFoundValue ); 00119 $this->getMatchRegularExpression()->setNotFoundValue( $objNotFoundValue ); 00120 return $this; 00121 } 00122 00128 public function getNotFoundValue() 00129 { 00130 return $this->objNotFoundValue; 00131 } 00132 00140 public function addItemName( $strItemName , $objValue = null ) 00141 { 00142 $this->getMatchName()->addItem( $strItemName , $objValue ); 00143 return $this; 00144 } 00145 00153 public function addItemRegularExpression( $strItemRegex , $objValue = null ) 00154 { 00155 $this->getMatchRegularExpression()->addItem( $strItemRegex , $objValue ); 00156 return $this; 00157 } 00158 00166 public function match( $strName ) 00167 { 00168 if( $this->getMatchName()->found( $strName ) ) 00169 { 00170 return $this->getMatchName()->match( $strName ); 00171 } 00172 if( $this->getMatchRegularExpression()->found( $strName ) ) 00173 { 00174 return $this->getMatchRegularExpression()->match( $strName ); 00175 } 00176 return $this->getNotFoundValue(); 00177 } 00178 00185 public function found( $strName ) 00186 { 00187 return 00188 ( 00189 ( $this->getMatchName()->found( $strName ) ) 00190 || 00191 ( $this->getMatchRegularExpression()->found( $strName ) ) 00192 ); 00193 } 00194 00200 public function isEmpty() 00201 { 00202 return 00203 ( 00204 ( $this->getMatchName()->isEmpty() ) 00205 && 00206 ( $this->getMatchRegularExpression()->isEmpty() ) 00207 ); 00208 } 00209 } 00210 ?>
1.5.9