Hoa central
Is.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Praspel\Model;
38 
47 class Is extends Clause
48 {
54  const NAME = 'is';
55 
61  const PURE = 1;
62 
68  protected $_property = 0;
69 
70 
71 
78  public function is($property)
79  {
80  return $property === ($this->_property & $property);
81  }
82 
89  public function setProperty($property)
90  {
91  $old = $this->_property;
92  $this->_property = $property;
93 
94  return $old;
95  }
96 
103  public function addProperty($property)
104  {
105  $old = $this->_property;
106  $this->_property |= $property;
107 
108  return $old;
109  }
110 
117  public function removeProperty($property)
118  {
119  $old = $this->_property;
120  $this->_property ^= $property;
121 
122  return $old;
123  }
124 
130  public function getProperty()
131  {
132  return $this->_property;
133  }
134 
140  public function getPropertyName()
141  {
142  $out = [];
143 
144  if (true === $this->is(static::PURE)) {
145  $out[] = 'pure';
146  }
147 
148  return implode(', ', $out);
149  }
150 
157  public static function getPropertyValue($property)
158  {
159  switch ($property) {
160  case 'pure':
161  return static::PURE;
162  }
163 
164  return 0;
165  }
166 }
addProperty($property)
Definition: Is.php:103
static getPropertyValue($property)
Definition: Is.php:157
removeProperty($property)
Definition: Is.php:117
is($property)
Definition: Is.php:78
setProperty($property)
Definition: Is.php:89