當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。