gyro/core/lib/components/policyholder.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Class holding a policy (bitflags) 00004 * 00005 * @author Gerd Riesselmann 00006 * @ingroup Lib 00007 */ 00008 class PolicyHolder implements IPolicyHolder { 00009 protected $policy = self::NONE; 00010 00011 /** 00012 * Constructor 00013 * 00014 * @param int $policy 00015 */ 00016 public function __construct($policy = self::NONE) { 00017 $this->policy = $policy; 00018 } 00019 00020 /** 00021 * Return policy 00022 * 00023 * @return int 00024 */ 00025 public function get_policy() { 00026 return $this->policy; 00027 } 00028 00029 /** 00030 * Set policy 00031 * 00032 * @param int $policy 00033 */ 00034 public function set_policy($policy) { 00035 $this->policy = $policy; 00036 } 00037 00038 /** 00039 * Returns true, if client has given policy 00040 * 00041 * @param int $policy 00042 * @return bool 00043 */ 00044 public function has_policy($policy) { 00045 return Common::flag_is_set($this->get_policy(), $policy); 00046 } 00047 }