Пример #1
0
 /**
  * Add Support for checking states with properties like isNew and isFinished.
  * 
  * @param string $name 
  * @return mixed Depends on Name.
  */
 public function __get($name)
 {
     $stateNames = array_values($this->getStates());
     if (preg_match('/^is(' . implode('|', $stateNames) . ')$/ui', $name, $matches)) {
         $index = array_search($matches[1], $stateNames);
         $states = array_keys($this->getStates());
         return $this->state == $states[$index];
     }
     return parent::__get($name);
 }