コード例 #1
0
ファイル: Currency.php プロジェクト: pupitooo/objects
 public function &__get($name)
 {
     if (array_key_exists($name, $this->other)) {
         return $this->other[$name];
     }
     return parent::__get($name);
 }
コード例 #2
0
ファイル: ObjectTest.php プロジェクト: Angerslave/youtrack
 public function test___set02()
 {
     $item = new Object();
     $value = 'bar';
     $item->setFoo($value);
     $this->assertEquals($value, $item->__get('foo'));
 }
コード例 #3
0
 function __get($name)
 {
     $prop = strtolower($name);
     if (in_array($prop, self::$Allowed)) {
         return isset($this->Properties[$prop]) ? $this->Properties[$prop] : null;
     }
     return parent::__get($name);
 }
コード例 #4
0
ファイル: CustomObject.php プロジェクト: simon-downes/spf
 public function __get($key)
 {
     if (isset($this->_getters[$key])) {
         return $this->{$this->_getters[$key]}();
     } else {
         return parent::__get($key);
     }
 }
コード例 #5
0
ファイル: bootstrap.php プロジェクト: lowjoel/phortress
 /**
  * Shorthand to retrieve the inaccessible property.
  *
  * @param string $name The name of the property
  * @return mixed The value of the property.
  */
 public function __get($name)
 {
     try {
         $property = $this->reflector->getProperty($name);
         $property->setAccessible(true);
         return $property->getValue($this->object);
     } catch (ReflectionException $e) {
         return $this->object->__get($name);
     }
 }
コード例 #6
0
ファイル: BaseModel.php プロジェクト: radypala/maga-website
 /**
  * Returns property value. Do not call directly.
  * support for models [e.g. rolesModel]
  * @param  string  property name
  * @return mixed   property value
  */
 public function &__get($name)
 {
     $className = ucfirst($name);
     if (String::endsWith($className, 'Model') && class_exists($className)) {
         if (!isset(self::$models[$className])) {
             self::$models[$className] = new $className();
         }
         return self::$models[$className];
     }
     return parent::__get($name);
 }
コード例 #7
0
ファイル: ServiceLocator.php プロジェクト: renyinew/blink
 public function __get($name)
 {
     if ($this->has($name)) {
         return $this->get($name);
     } else {
         return parent::__get($name);
     }
 }
コード例 #8
0
ファイル: Object.php プロジェクト: brussens/cogear2
 /**
  * Magic __get method
  *
  * @param type $name
  */
 public function __get($name)
 {
     if ($this->elements->{$name}) {
         return $this->elements->{$name};
     }
     return parent::__get($name);
 }
コード例 #9
0
ファイル: DbObject.php プロジェクト: rgigger/zinc
 /**
  * Automatic getter: maps unknown variables to database fields
  *
  * @param string $varname Name of the database field to get the value of
  * @return mixed Value of the given database field
  */
 public function __get($varname)
 {
     // check on inherited getters, setters, and mixins from Object
     if (parent::__isset($varname)) {
         return parent::__get($varname);
     }
     if ($this->hasRelationship($varname)) {
         return $this->getRelationshipInfo($varname);
     }
     return $this->getScalar($varname);
 }
コード例 #10
0
	/**
	 * Обновляет данные в словаре
	 * @param $name String: Имя словаря
	 * @param $data Array: Данные для
	 */
	public function update($name, $new_data, $condition = array())
	{
		$name = strtolower($name);

		parent::__get("DB")->update($name, $new_data, $condition);

		$this->clear_cache($name);
	}
コード例 #11
0
ファイル: GraphObject.php プロジェクト: sledgehammer/facebook
 /**
  * Fetch connected grapobjects and store in the property.
  *
  * @param string $property
  * @return mixed
  */
 function __get($property)
 {
     if (empty($this->id)) {
         return parent::__get($property);
     }
     $connections = $this->getKnownConnections();
     if (array_key_exists($property, $connections) === false) {
         // not a (known) connection?
         if ($this->_state === 'id_only') {
             $fields = Facebook::get($this->id, $this->_apiParameters);
             $this->__set($fields);
             $this->_state = 'ready';
             unset($this->_apiParameters);
             if (array_key_exists($property, $fields)) {
                 return $fields[$property];
             }
         }
         if ($this->_state === 'partial') {
             $fields = Facebook::get($this->id);
             $this->__set($fields);
             $this->_state = 'ready';
             if (array_key_exists($property, $fields)) {
                 return $fields[$property];
             }
         }
         $fields = get_public_vars(get_class($this));
         if (array_key_exists($property, $fields)) {
             // is the field defined in the class?
             $permissions = static::getFieldPermissions(array('id' => $this->id));
             if (isset($permissions[$property]) && $permissions[$property] !== 'denied' && in_array($permissions[$property], Facebook::getInstance()->getPermissions()) === false) {
                 notice('Field "' . $property . '" requires the "' . $permissions[$property] . '" permission', 'Current permissions: ' . quoted_human_implode(' and ', Facebook::getInstance()->getPermissions()));
             }
             return parent::__get($property);
         }
     }
     try {
         // Retrieve a connection
         if (isset($connections[$property]['class'])) {
             $parameters = array('fields' => call_user_func(array($connections[$property]['class'], 'getAllowedFields')));
         } else {
             $parameters = array();
         }
         $method = 'get' . ucfirst($property);
         $this->__set(array($property => $this->{$method}($parameters)));
         return $this->{$property};
     } catch (\Exception $e) {
         report_exception($e);
         return parent::__get($property);
     }
 }
コード例 #12
0
 /**
  * Get a property
  *
  * Implement a virtual 'parameters' property to return the parameters object.
  *
  * @param   string $name  The property name.
  * @return  string $value The property value.
  */
 public function __get($name)
 {
     if ($name = 'parameters') {
         return $this->getParameters();
     }
     return parent::__get($name);
 }
コード例 #13
0
ファイル: Identity.php プロジェクト: jakubkulhan/shopaholic
 /**
  * Returns user data value.
  * @param  string  property name
  * @return mixed
  */
 public function &__get($key)
 {
     if ($key === 'name' || $key === 'roles') {
         return parent::__get($key);
     } else {
         return $this->data[$key];
     }
 }