当前位置: 首页>>代码示例>>PHP>>正文


PHP Object::__get方法代码示例

本文整理汇总了PHP中Object::__get方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::__get方法的具体用法?PHP Object::__get怎么用?PHP Object::__get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Object的用法示例。


在下文中一共展示了Object::__get方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 public function &__get($name)
 {
     if (array_key_exists($name, $this->other)) {
         return $this->other[$name];
     }
     return parent::__get($name);
 }
开发者ID:pupitooo,项目名称:objects,代码行数:7,代码来源:Currency.php

示例2: test___set02

 public function test___set02()
 {
     $item = new Object();
     $value = 'bar';
     $item->setFoo($value);
     $this->assertEquals($value, $item->__get('foo'));
 }
开发者ID:Angerslave,项目名称:youtrack,代码行数:7,代码来源:ObjectTest.php

示例3: strtolower

 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);
 }
开发者ID:noloh,项目名称:FullCalendar,代码行数:8,代码来源:FullCalendarEvent.php

示例4: __get

 public function __get($key)
 {
     if (isset($this->_getters[$key])) {
         return $this->{$this->_getters[$key]}();
     } else {
         return parent::__get($key);
     }
 }
开发者ID:simon-downes,项目名称:spf,代码行数:8,代码来源:CustomObject.php

示例5: __get

 /**
  * 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);
     }
 }
开发者ID:lowjoel,项目名称:phortress,代码行数:16,代码来源:bootstrap.php

示例6: ucfirst

 /**
  * 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);
 }
开发者ID:radypala,项目名称:maga-website,代码行数:17,代码来源:BaseModel.php

示例7: __get

 public function __get($name)
 {
     if ($this->has($name)) {
         return $this->get($name);
     } else {
         return parent::__get($name);
     }
 }
开发者ID:renyinew,项目名称:blink,代码行数:8,代码来源:ServiceLocator.php

示例8: __get

 /**
  * Magic __get method
  *
  * @param type $name
  */
 public function __get($name)
 {
     if ($this->elements->{$name}) {
         return $this->elements->{$name};
     }
     return parent::__get($name);
 }
开发者ID:brussens,项目名称:cogear2,代码行数:12,代码来源:Object.php

示例9: __get

 /**
  * 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);
 }
开发者ID:rgigger,项目名称:zinc,代码行数:17,代码来源:DbObject.php

示例10: update

	/**
	 * Обновляет данные в словаре
	 * @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);
	}
开发者ID:nDIGAH3CEYIiCsq,项目名称:gold,代码行数:13,代码来源:dictionaries.inc.php

示例11: unset

 /**
  * 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);
     }
 }
开发者ID:sledgehammer,项目名称:facebook,代码行数:56,代码来源:GraphObject.php

示例12: __get

 /**
  * 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);
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:15,代码来源:abstract.php

示例13:

 /**
  * 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];
     }
 }
开发者ID:jakubkulhan,项目名称:shopaholic,代码行数:13,代码来源:Identity.php


注:本文中的Object::__get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。