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


PHP Resource::offsetGet方法代码示例

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


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

示例1: offsetGet

 public function offsetGet($name)
 {
     if (parent::offsetExists($name)) {
         return parent::offsetGet($name);
     }
     $resource = null;
     if (isset($this->static[$name])) {
         $resource = $this->static[$name];
     } elseif (isset($this->resources[$name])) {
         $resource = $this->resources[$name];
     }
     if ($resource === null) {
         throw new \OutOfBoundsException();
     }
     $resource->__parent = $this;
     $resource->__name = $name;
     return $resource;
 }
开发者ID:guide42,项目名称:traba,代码行数:18,代码来源:ResourceMapping.php

示例2: offset_get_result

 /**
  * Get record field value as a record result
  *
  * @param  string $field
  * @return mixed
  **/
 public function offset_get_result($field)
 {
     $data_links = null;
     if (isset($this->links['*'])) {
         $data_links = $this->links['*'];
     } else {
         if (isset($this->links[$field]['links'])) {
             $data_links = $this->links[$field]['links'];
         }
     }
     $data_value = parent::offsetExists($field) ? parent::offsetGet($field) : null;
     if (is_array($data_value) && !empty($data_value)) {
         $collection = isset($this->headers['$collection']) ? $this->headers['$collection'] : null;
         $data_record = new Record(array('$url' => $this->link_url($field), '$data' => $data_value, '$links' => $data_links, '$collection' => $collection));
         $this->offsetSet($field, $data_record);
         return $data_record;
     } else {
         if (!isset($data_value)) {
             // Find object within array by id
             $data = $this->getArrayCopy();
             foreach ($data as $data_val) {
                 if (isset($data_val['id']) && $data_val['id'] === $field) {
                     $data_value = $data_val;
                     break;
                 }
             }
         }
     }
     return $data_value;
 }
开发者ID:thisislawatts,项目名称:schema-php-client,代码行数:36,代码来源:Record.php

示例3: offset_get_result

 /**
  * Get record field value as a record result
  *
  * @param  string $field
  * @return mixed
  **/
 public function offset_get_result($field)
 {
     $data_links = null;
     if (isset($this->links['*'])) {
         $data_links = $this->links['*'];
     } else {
         if (isset($this->links[$field]['links'])) {
             $data_links = $this->links[$field]['links'];
         }
     }
     $data_value = parent::offsetExists($field) ? parent::offsetGet($field) : null;
     if (is_array($data_value) && !empty($data_value)) {
         $collection = isset($this->headers['$collection']) ? $this->headers['$collection'] : null;
         $data_record = new Record(array('$url' => $this->link_url($field), '$data' => $data_value, '$links' => $data_links, '$collection' => $collection));
         $this->offsetSet($field, $data_record);
         return $data_record;
     }
     return $data_value;
 }
开发者ID:schemaio,项目名称:schema-wp-basis,代码行数:25,代码来源:Record.php


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