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


PHP Object::__get方法代码示例

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


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

示例1: catch

 /**
  * Getter
  *
  * @param string $name
  * @return mixed
  * @throws MemberAccessException
  */
 public function &__get($name)
 {
     try {
         return $this->universalGetValue($name);
     } catch (\MemberAccessException $e) {
         return parent::__get($name);
     }
 }
开发者ID:nella,项目名称:ActiveMapper,代码行数:15,代码来源:Proxy.php

示例2:

 public function &__get($name)
 {
     $val = \strtoupper($name);
     if (\defined(self::INFO . $val)) {
         $a = $this->getInfo(constant(self::INFO . $val));
         return $a;
     }
     return parent::__get($name);
 }
开发者ID:rokerkony,项目名称:Exchange,代码行数:9,代码来源:CUrl.php

示例3:

 /**
  * Returns user data value.
  * @param string property name
  * @return mixed
  */
 public function &__get($key)
 {
     if (parent::__isset($key)) {
         return parent::__get($key);
     } else {
         $data = $this->data->toArray();
         return $data[$key];
     }
 }
开发者ID:angelcam,项目名称:angelcam-sdk-php,代码行数:14,代码来源:Identity.php

示例4:

 public function &__get($name)
 {
     $service = $this->getService($name, false);
     if ($service) {
         return $service;
     }
     $object = parent::__get($name);
     return $object;
 }
开发者ID:pipaslot,项目名称:rest,代码行数:9,代码来源:AContext.php

示例5: elseif

 /**
  * @param  string
  * @return string|NULL
  */
 public function &__get($name)
 {
     if (strtolower($name) === 'info') {
         return $this->info;
     } elseif (array_key_exists($name, $this->info)) {
         return $this->info[$name];
     }
     return parent::__get($name);
 }
开发者ID:milo,项目名称:github-api-nette,代码行数:13,代码来源:User.php

示例6: catch

 /**
  * @param string $name
  * @return mixed
  *
  * @throws \Exception|\Nette\MemberAccessException
  */
 public function &__get($name)
 {
     try {
         return parent::__get($name);
     } catch (MemberAccessException $e) {
         $data = $this->getData();
         if (isset($data[$name])) {
             return $data[$name];
         }
         throw $e;
     }
 }
开发者ID:lucien144,项目名称:Restful,代码行数:18,代码来源:Input.php

示例7:

 /**
  * Returns user data value.
  * @param  string  property name
  * @return mixed
  */
 public function &__get($key)
 {
     if (parent::__isset($key)) {
         return parent::__get($key);
     } else {
         return $this->data[$key];
     }
 }
开发者ID:eduardobenito10,项目名称:jenkins-php-quickstart,代码行数:13,代码来源:Identity.php

示例8:

 public function &__get($name)
 {
     if (parent::__isset($name)) {
         return parent::__get($name);
     }
     $value = $this->data->{$name};
     if ($value instanceof ActiveRow) {
         $value = $this->repository->getReferenced($name, NULL, $value);
     }
     return $value;
 }
开发者ID:redwormik,项目名称:fakeorm,代码行数:11,代码来源:Entity.php

示例9:

 /**
  * Getter proměnných.
  * @param mixed $name
  * @return mixed
  */
 public function &__get($name)
 {
     return parent::__get($name);
 }
开发者ID:JZechy,项目名称:ZBox,代码行数:9,代码来源:BaseEntity.php

示例10: array

 /**
  * Provides access to shortcuts of page elements defined using property-read
  * annotations (eg. `property-read Element $name strategy=value`).
  *
  * If there is a getter for the value (eg. method `getFoo()` for `$foo` property),
  * the getter is used instead.
  *
  * Definition of a shortcut may include the tag name and required attributes
  * values. These are checked then. Eg. `property-read Element $name
  * strategy=value, tagName, [attrib=value, another=value]`.
  *
  * Eventual comment may be separated by a space and a hash: `property-read
  * Element $name strategy=value # Now this is a comment.`
  *
  * @param string $name
  * @return mixed
  */
 public function &__get($name)
 {
     $shortcuts = $this->getShortcuts();
     if (!parent::__isset($name) && isset($shortcuts[$name])) {
         $this->checkState();
         $criteria = array('strategy' => $shortcuts[$name][0], 'selector' => $shortcuts[$name][1]);
         $expectedTagName = isset($shortcuts[$name][3]) ? $shortcuts[$name][3] : NULL;
         $expectedAttribs = isset($shortcuts[$name][4]) ? $shortcuts[$name][4] : NULL;
         if ($shortcuts[$name][2]) {
             $elements = $this->findElements($criteria['strategy'], $criteria['selector']);
             foreach ($elements as $index => $element) {
                 $shortcutDescription = get_class($this) . '::$' . $name . "[{$index}]";
                 $this->checkTagNameAndAttributes($element, $shortcutDescription, $expectedTagName, $expectedAttribs);
             }
             return $elements;
         } else {
             $element = $this->findElement($criteria['strategy'], $criteria['selector']);
             $shortcutDescription = get_class($this) . '::$' . $name;
             $this->checkTagNameAndAttributes($element, $shortcutDescription, $expectedTagName, $expectedAttribs);
             return $element;
         }
     } else {
         return parent::__get($name);
     }
 }
开发者ID:clevis,项目名称:se34,代码行数:42,代码来源:PageComponent.php

示例11: catch

 public function &__get($name)
 {
     if ($this->entity) {
         try {
             $value = $this->entity->{$name};
             return $value;
         } catch (MemberAccessException $e) {
         }
     }
     return parent::__get($name);
 }
开发者ID:librette,项目名称:security-extension,代码行数:11,代码来源:EntityIdentity.php

示例12: catch

 /**
  * Returns property value. Do not call directly.
  * Tries to use dynamic getter for protected properties (reflection fields) if getter is not defined.
  *
  * @param  string  property name
  * @return mixed   property value
  * @throws MemberAccessException if the property is not defined.
  */
 public function &__get($name)
 {
     try {
         $value = parent::__get($name);
         return $value;
     } catch (MemberAccessException $e) {
         if ($this->hasProtectedReflectionField($name)) {
             // intentionally not used __isset
             $value = $this->{$name};
             return $value;
         } else {
             $class = get_called_class();
             throw new MemberAccessException($e->getMessage() . " If you want to use dynamic getter for this property, make sure that property has visibility 'protected'.");
         }
     }
 }
开发者ID:romansklenar,项目名称:nette-activeentity,代码行数:24,代码来源:ActiveEntity.php

示例13:

 /**
  * @param string $name
  * @return mixed
  */
 public function &__get($name)
 {
     if ($this->isOption($name) && !property_exists($this, $name)) {
         return $this->options[$name];
     }
     return parent::__get($name);
 }
开发者ID:noikiy,项目名称:Curl,代码行数:11,代码来源:CurlWrapper.php

示例14: foreach

 public function &__get($name)
 {
     foreach ($this->getExtensions() as $extension) {
         /* @var $extension ExtensionObject */
         if ($extension->getReflection()->hasProperty($name)) {
             $property = $extension->getReflection()->getProperty($name);
             if ($property->isPublic() && !$property->isStatic()) {
                 return $extension->{$name};
             }
         }
         if (ObjectMixin::has($extension, $name)) {
             return ObjectMixin::get($extension, $name);
         }
     }
     return parent::__get($name);
 }
开发者ID:jsmitka,项目名称:ExtensionObjects,代码行数:16,代码来源:ExtensibleObject.php


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