public function &__get($name) { if (array_key_exists($name, $this->other)) { return $this->other[$name]; } return parent::__get($name); }
public function test___set02() { $item = new Object(); $value = 'bar'; $item->setFoo($value); $this->assertEquals($value, $item->__get('foo')); }
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); }
public function __get($key) { if (isset($this->_getters[$key])) { return $this->{$this->_getters[$key]}(); } else { return parent::__get($key); } }
/** * 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); } }
/** * 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); }
public function __get($name) { if ($this->has($name)) { return $this->get($name); } else { return parent::__get($name); } }
/** * Magic __get method * * @param type $name */ public function __get($name) { if ($this->elements->{$name}) { return $this->elements->{$name}; } return parent::__get($name); }
/** * 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); }
/** * Обновляет данные в словаре * @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); }
/** * 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); } }
/** * 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); }
/** * 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]; } }