root/components/match/MatchGatekeeper.class.php

136142
1
<?php
1
<?php
2
/**
2
/**
3
 * MatchGateKeeper - Gate opener make a match using white list and black list.
3
 * MatchGatekeeper - Gate opener make a match using white list and black list.
4
 * @package Match
4
 * @package Match
5
 */
5
 */
6
6
...
...
12
 * and black list, with the forbiden names.
12
 * and black list, with the forbiden names.
13
 *
13
 *
14
 * @example{
14
 * @example{
15
 *   $objMatch = new MatchGateKeeper();
15
 *   $objMatch = new MatchGatekeeper();
16
 *   $objMatch->getAllowedMatch()->addItemName( "just" );
16
 *   $objMatch->getAllowedMatch()->addItemName( "just" );
17
 *   $objMatch->getAllowedMatch()->addItemName( "us" );
17
 *   $objMatch->getAllowedMatch()->addItemName( "us" );
18
 * 	 if ( $objMatch->match( "other" ) !== false ) return false;
18
 * 	 if ( $objMatch->match( "other" ) !== false ) return false;
...
...
20
 * }
20
 * }
21
 *
21
 *
22
 * @example{
22
 * @example{
23
 *   $objMatch = new MatchGateKeeper();
23
 *   $objMatch = new MatchGatekeeper();
24
 *   $objMatch->getForbiddenMatch()->addItemRegularExpression( "^set*" );
24
 *   $objMatch->getForbiddenMatch()->addItemRegularExpression( "^set*" );
25
 *   $objMatch->getForbiddenMatch()->addItemRegularExpression( "^get*" );
25
 *   $objMatch->getForbiddenMatch()->addItemRegularExpression( "^get*" );
26
 *   $objMatch->getForbiddenMatch()->addItemName( "play" );
26
 *   $objMatch->getForbiddenMatch()->addItemName( "play" );
...
...
32
 * }
32
 * }
33
 *
33
 *
34
 */
34
 */
35
class MatchGateKeeper implements MatchInterface
35
class MatchGatekeeper implements MatchInterface
36
{
36
{
37
    /**
37
    /**
38
     * Match Group of the Forbidden List
38
     * Match Group of the Forbidden List
...
...
75
     * set the forbiden list match
75
     * set the forbiden list match
76
     *
76
     *
77
     * @param Match $objForbidenMatch
77
     * @param Match $objForbidenMatch
78
     * @return MatchGateKeeper me
78
     * @return MatchGatekeeper me
79
     */
79
     */
80
    public function setForbidenMatch( Match $objForbidenMatch )
80
    public function setForbidenMatch( Match $objForbidenMatch )
81
    {
81
    {
...
...
97
     * Set the allowed list match
97
     * Set the allowed list match
98
     *
98
     *
99
     * @param Match $objAllowedMatch
99
     * @param Match $objAllowedMatch
100
     * @return MatchGateKeeper me
100
     * @return MatchGatekeeper me
101
     */
101
     */
102
    public function setAllowedMatch( Match $objAllowedMatch )
102
    public function setAllowedMatch( Match $objAllowedMatch )
103
    {
103
    {
...
...
120
     * not be found into any list
120
     * not be found into any list
121
     *
121
     *
122
     * @param object <value> $objValue
122
     * @param object <value> $objValue
123
     * @return MatchGateKeeper
123
     * @return MatchGatekeeper
124
     */
124
     */
125
    public function setNotFoundValue( $objValue )
125
    public function setNotFoundValue( $objValue )
126
    {
126
    {
...
...
145
     * Set the value of a name into the forbidden list
145
     * Set the value of a name into the forbidden list
146
     *
146
     *
147
     * @param object <value> $objValue
147
     * @param object <value> $objValue
148
     * @return MatchGateKeeper
148
     * @return MatchGatekeeper
149
     */
149
     */
150
    public function setDeniedValue( $objValue )
150
    public function setDeniedValue( $objValue )
151
    {
151
    {