MatchGateKeeperExample1.php

Go to the documentation of this file.
00001 <?php
00002 /* 
00003  * Examples using the match gate opener.
00004  *
00005  * @package Match
00006  */
00007 
00008 require_once( "_start.php" );
00009 
00010 function MatchGateKeeperExample1()
00011 {
00012     $objMatch = new MatchGateKeeper();
00013     $objMatch->getAllowedMatch()->addItemName( "just" );
00014     $objMatch->getAllowedMatch()->addItemName( "us" );
00015         if ( $objMatch->match( "other" ) !== false ) return false;
00016 
00017     $objMatch = new MatchGateKeeper();
00018     $objMatch->getForbiddenMatch()->addItemRegularExpression("^set*");
00019     $objMatch->getForbiddenMatch()->addItemRegularExpression("^get*");
00020     $objMatch->getForbiddenMatch()->addItemName( "play" );
00021         if ( $objMatch->match( "setSomething" ) !== false ) return false;
00022         if ( $objMatch->match( "getSomething" ) !== false ) return false;
00023         if ( $objMatch->match( "play" ) !== false ) return false;
00024         if ( $objMatch->match( "other" ) !== true) return false;
00025 
00026     return true;
00027 }
00028 
00029 if( MatchGateKeeperExample1() === TRUE )
00030 {
00031         print "ok!";
00032 }
00033 else
00034 {
00035         print "fail!";
00036 }
00037 ?>

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