Пример #1
0
 public function __set($name, $value)
 {
     switch ($name) {
         case 'nullable':
             $this->_nullable = (bool) $value;
             break;
         default:
             parent::__set($name, $value);
     }
 }
Пример #2
0
 public function __set($name, $value)
 {
     switch ($name) {
         case 'bar':
             if (is_int($value)) {
                 $this->bar = $value;
                 break;
             } else {
                 throw new PropertyException("A::bar must be an integer");
             }
         default:
             parent::__set($name, $value);
     }
 }
Пример #3
0
 /**
  * Property setters handler
  * @param string $name Property name
  * @param mixed $value Property value
  * @throws PropertyException
  * @see Object::__set()
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'config':
             if (!$value instanceof Config) {
                 throw new PropertyException('Config object excepted, ' . gettype($value) . ' given.');
             } elseif ($value->app != $this) {
                 throw new PropertyException('Foreign application given');
             }
             $this->_config = $value;
             break;
         case 'error_route':
             if (!$value instanceof Route) {
                 throw new PropertyException('Route object excepted, ' . gettype($value) . ' given.');
             } elseif ($value->app != $this) {
                 throw new PropertyException('Foreign application given');
             }
             $this->_error_route = $value;
             break;
         default:
             parent::__set($name, $value);
     }
 }