
Public Member Functions | |
| __construct () | |
| setForbidenMatch (Match $objForbidenMatch) | |
| getForbiddenMatch () | |
| setAllowedMatch (Match $objAllowedMatch) | |
| getAllowedMatch () | |
| setNotFoundValue ($objValue) | |
| getNotFoundValue () | |
| setDeniedValue ($objValue) | |
| getDeniedValue () | |
| match ($strName) | |
| found ($strName) | |
Protected Attributes | |
| $objForbidenMatch | |
| $objAllowedMatch | |
| $objNotFoundValue = true | |
| $objDeniedValue = false | |
$objMatch = new MatchGatekeeper(); $objMatch->getAllowedMatch()->addItemName( "just" ); $objMatch->getAllowedMatch()->addItemName( "us" ); if ( $objMatch->match( "other" ) !== false ) return false; return true;
true
$objMatch = new MatchGatekeeper(); $objMatch->getForbiddenMatch()->addItemRegularExpression( "^set*" ); $objMatch->getForbiddenMatch()->addItemRegularExpression( "^get*" ); $objMatch->getForbiddenMatch()->addItemName( "play" ); if ( $objMatch->match( "setSomething" ) !== false ) return false; if ( $objMatch->match( "getSomething" ) !== false ) return false; if ( $objMatch->match( "play" ) !== false ) return false; if ( $objMatch->match( "other" ) !== true) return false; return true;
true
Definition at line 35 of file MatchGatekeeper.class.php.
| __construct | ( | ) |
constructor create the class matchs
Definition at line 68 of file MatchGatekeeper.class.php.
00069 { 00070 $this->objForbidenMatch = new MatchGroup(); 00071 $this->objAllowedMatch = new MatchGroup(); 00072 }
| found | ( | $ | strName | ) |
Found the string name
| string | $strName |
Implements MatchInterface.
Definition at line 210 of file MatchGatekeeper.class.php.
References getAllowedMatch(), and getForbiddenMatch().
Referenced by match().
00211 { 00212 // if forbidden list exists // 00213 if( $this->getForbiddenMatch()->isEmpty() == false ) 00214 { 00215 // if is forbidden // 00216 if( $this->getForbiddenMatch()->found( $strName ) ) 00217 { 00218 // return false // 00219 return false; 00220 } 00221 } 00222 // if allowed restriction list exists // 00223 if( $this->getAllowedMatch()->isEmpty() == false ) 00224 { 00225 // if is allowed // 00226 if( $this->getAllowedMatch()->found( $strName ) ) 00227 { 00228 // return true // 00229 return true; 00230 } 00231 } 00232 // the element was not founded in any list // 00233 return false; 00234 }
| getAllowedMatch | ( | ) |
Get the allowed list match
Definition at line 113 of file MatchGatekeeper.class.php.
Referenced by found(), match(), and setNotFoundValue().
| getDeniedValue | ( | ) |
Get the value of a name into the forbidden list
Definition at line 161 of file MatchGatekeeper.class.php.
Referenced by match().
| getForbiddenMatch | ( | ) |
get the forbiden list match
Definition at line 91 of file MatchGatekeeper.class.php.
Referenced by found(), match(), and setNotFoundValue().
| getNotFoundValue | ( | ) |
Get the value what shoul be return when the name not be found into any list
Implements MatchInterface.
Definition at line 139 of file MatchGatekeeper.class.php.
Referenced by match().
| match | ( | $ | strName | ) |
Match the string name
| string | $strName |
Implements MatchInterface.
Definition at line 172 of file MatchGatekeeper.class.php.
References found(), getAllowedMatch(), getDeniedValue(), getForbiddenMatch(), and getNotFoundValue().
00173 { 00174 // if forbidden list exists // 00175 if( $this->getForbiddenMatch()->isEmpty() == false ) 00176 { 00177 // if is forbidden // 00178 if( $this->getForbiddenMatch()->found( $strName ) ) 00179 { 00180 // return denied value // 00181 return $this->getDeniedValue(); 00182 } 00183 } 00184 // if allowed restriction list exists // 00185 if( $this->getAllowedMatch()->isEmpty() == false ) 00186 { 00187 // if is allowed // 00188 if( $this->getAllowedMatch()->found( $strName ) ) 00189 { 00190 // return the allowed value // 00191 return $this->getAllowedMatch()->match( $strName ); 00192 } 00193 else 00194 { 00195 // else return the denied value // 00196 return $this->getDeniedValue(); 00197 } 00198 } 00199 // else return the not found value // 00200 return $this->getNotFoundValue(); 00201 }
| setAllowedMatch | ( | Match $ | objAllowedMatch | ) |
Set the allowed list match
| Match | $objAllowedMatch |
Definition at line 102 of file MatchGatekeeper.class.php.
00103 { 00104 $this->objAllowedMatch = $objAllowedMatch; 00105 return $this; 00106 }
| setDeniedValue | ( | $ | objValue | ) |
Set the value of a name into the forbidden list
| object | $objValue |
Definition at line 150 of file MatchGatekeeper.class.php.
| setForbidenMatch | ( | Match $ | objForbidenMatch | ) |
Definition at line 80 of file MatchGatekeeper.class.php.
00081 { 00082 $this->objForbidenMatch = $objForbidenMatch; 00083 return $this; 00084 }
| setNotFoundValue | ( | $ | objValue | ) |
Set the value what should be return when the name not be found into any list
| object | $objValue |
Implements MatchInterface.
Definition at line 125 of file MatchGatekeeper.class.php.
References getAllowedMatch(), and getForbiddenMatch().
00126 { 00127 $this->objNotFoundValue = $objValue; 00128 $this->getAllowedMatch->setNotFoundValue( $objValue ); 00129 $this->getForbiddenMatch->setNotFoundValue( $objValue ); 00130 return $this; 00131 }
$objAllowedMatch [protected] |
$objDeniedValue = false [protected] |
Value what should return when the name match into the forbiden list
Definition at line 63 of file MatchGatekeeper.class.php.
$objForbidenMatch [protected] |
Match Group of the Forbidden List
Definition at line 42 of file MatchGatekeeper.class.php.
$objNotFoundValue = true [protected] |
Value what should return when the name dont match with the allowed list even with the forbiden list
object
Definition at line 57 of file MatchGatekeeper.class.php.
1.5.9