<?php 

class Mutex {
    
    private $key;
    private $value;

    private $type;

    private $others;

    public function __construct($key,$others,$type=1,$value = null) {
        $this->key = $key;
        $this->type = $type;
        $this->others = $others;
        $this->value = $value;
    }

    public function handle(&$arguments) {
        if($this->type==1) {//只要存在该值，其他值就要过滤到
            if($arguments[$this->key]) 
			{   
                foreach($this->others as $v) {echo '=';print_r($v);print_r($arguments[$v]);echo '=';
                    unset($arguments[$v]);
                }
			}
        }
        if($this->type==2) {//只有该值不等于特定值时 才过滤其他值
            if($arguments[$this->key]!=$this->value) 
			{   
                foreach($this->others as $v) {
                    unset($arguments[$v]);
                }
			}
        }
    }

    public function getKey() {
        return $this->key;
    }

}

?>