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


PHP ArrayObject::offsetGet方法代码示例

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


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

示例1: getParam

 /**
  * Obtem um param enviado via Request Http
  * @param int|string $index
  * @return mixed|boolean
  */
 public function getParam($index)
 {
     if ($this->params->offsetExists($index)) {
         return $this->params->offsetGet($index);
     }
     return false;
 }
开发者ID:avandrevitor,项目名称:S9,代码行数:12,代码来源:Request.php

示例2: validate

 /**
  * Valida o código de barras.
  * @param mixed $value
  * @return boolean
  */
 public function validate($input)
 {
     $input = new StringHelper($input);
     $digitoCean = 0;
     $indiceInicial = 0;
     $digitoCalculo = 0;
     $digitoCalculado = 0;
     $tamCean = $input->length;
     $ceanSemDigito = new StringHelper();
     if (!in_array($tamCean, array(8, 12, 13, 14, 18))) {
         return false;
     }
     $digitoCean = (int) $input->right(1, 1)->getValue();
     $ceanSemDigito->setValue($input->left(0, $input->length - 1)->getValue());
     $indiceInicial = $this->p->count() - $ceanSemDigito->length;
     for ($i = 0; $i < $ceanSemDigito->length; $i++) {
         $digitoCalculo += (int) $ceanSemDigito->substring($i, 1)->getValue() * $this->p->offsetGet($indiceInicial++);
     }
     if ($digitoCalculo % 10 == 0) {
         $digitoCalculado = 0;
     } else {
         $divTemp = (int) ceil($digitoCalculo / 10.0) * 10;
         $digitoCalculado = $divTemp - $digitoCalculo;
     }
     if ($digitoCalculado === $digitoCean) {
         return true;
     }
     return false;
 }
开发者ID:charlanalves,项目名称:sped,代码行数:34,代码来源:Cean.php

示例3: getDirectory

 /**
  * Obtem o caminho de um diretorio
  * @param string $index
  * @return boolean
  */
 public function getDirectory($index)
 {
     if ($this->paths->offsetExists($index)) {
         return $this->paths->offsetGet($index);
     }
     return false;
 }
开发者ID:harleysad,项目名称:harley-framework,代码行数:12,代码来源:View.php

示例4: service

 /**
  * Get a service.
  *
  * @param string $name The name of the service
  *
  * @return \Subbly\Api\Service\Service
  *
  * @throws \Subbly\Api\Exception If the service name does not exists
  *
  * @api
  */
 public function service($name)
 {
     if (!$this->services->offsetExists($name)) {
         throw new Exception(sprintf(Exception::SERVICE_NOT_EXISTS, $name));
     }
     return $this->services->offsetGet($name);
 }
开发者ID:subbly,项目名称:framework,代码行数:18,代码来源:Api.php

示例5: getComponentData

 /**
  * Get component data
  *
  * @param string $name
  * @return array
  * @throws LocalizedException
  */
 public function getComponentData($name)
 {
     if (!$this->componentData->offsetExists($name)) {
         throw new LocalizedException(new Phrase('The requested component ("' . $name . '") is not found. ' . 'Before using, you must add the implementation.'));
     }
     return (array) $this->componentData->offsetGet($name);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:Definition.php

示例6: getArgument

 /**
  * @return mixed
  * @param string $name
  * @param mixed $defaultValue
  */
 public function getArgument($name, $defaultValue = null)
 {
     if ($this->arguments->offsetExists($name)) {
         return $this->arguments->offsetGet($name);
     }
     return $defaultValue;
 }
开发者ID:visor,项目名称:nano,代码行数:12,代码来源:Event.php

示例7: getParam

 public function getParam($name)
 {
     if (!$this->storage->offsetExists($name)) {
         return null;
     }
     return $this->storage->offsetGet($name);
 }
开发者ID:renatosalvatori,项目名称:visio-crud-zf2,代码行数:7,代码来源:Params.php

示例8: getOption

 /**
  * Returns required option value
  *
  * @param string $optionName
  * @return mixed
  */
 public function getOption($optionName)
 {
     if ($this->_options instanceof ArrayObject && $this->_options->offsetExists($optionName)) {
         return $this->_options->offsetGet($optionName);
     }
     return NULL;
 }
开发者ID:ivan-novakov,项目名称:ac-client-lib,代码行数:13,代码来源:Base.php

示例9: processQueue

 /**
  * Proccess queue
  *
  * @param int $maxExecutionTime Maximum execution time available
  *
  * @return boolean If all requested items could be processed
  */
 public function processQueue($maxExecutionTime = INF)
 {
     try {
         /* @var $shipment Dhl_Intraship_Model_Mysql4_Shipment_Collection */
         $collection = Mage::getModel('intraship/shipment')->getCollection()->joinOrderTable();
         // Add filter status codes to where clause.
         $collection->addFieldToFilter('main_table.status', array('in' => array(Dhl_Intraship_Model_Shipment::STATUS_NEW_QUEUED, Dhl_Intraship_Model_Shipment::STATUS_NEW_RETRY, Dhl_Intraship_Model_Shipment::STATUS_CANCEL_QUEUED, Dhl_Intraship_Model_Shipment::STATUS_CANCEL_RETRY)));
         // Create shipment for each queue.
         if (0 < count($collection)) {
             $startTime = time();
             $shipmentOffset = 0;
             /* @var $row Dhl_Intraship_Model_Shipment */
             foreach ($collection as $shipment) {
                 ++$shipmentOffset;
                 //Skip shipment if current status has changed to avoid double shipment transmission
                 if (Mage::getModel('intraship/shipment')->load($shipment->getId())->getStatus() != $shipment->getStatus()) {
                     continue;
                 }
                 try {
                     $fallback = new ArrayObject(array());
                     if (!$shipment instanceof Dhl_Intraship_Model_Shipment) {
                         continue;
                     }
                     switch ($shipment->getStatus()) {
                         case Dhl_Intraship_Model_Shipment::STATUS_NEW_QUEUED:
                         case Dhl_Intraship_Model_Shipment::STATUS_NEW_RETRY:
                             $fallback->offsetSet('type', 'create');
                             $fallback->offsetSet('status', Dhl_Intraship_Model_Shipment::STATUS_NEW_FAILED);
                             $this->_create($shipment);
                             break;
                         case Dhl_Intraship_Model_Shipment::STATUS_CANCEL_QUEUED:
                         case Dhl_Intraship_Model_Shipment::STATUS_CANCEL_RETRY:
                             $fallback->offsetSet('type', 'cancel');
                             $fallback->offsetSet('status', Dhl_Intraship_Model_Shipment::STATUS_CANCELED_FAILED);
                             $this->_cancel($shipment);
                             break;
                     }
                 } catch (Exception $e) {
                     Mage::logException($e);
                     $this->logMessage($e->getMessage());
                     $shipment->setStatus($fallback->offsetGet('status'))->setClientStatusCode(1000)->setClientStatusMessage($e->getMessage())->addComment($e->getMessage(), $fallback->offsetGet('status'), $fallback->offsetGet('type'));
                 }
                 if ($shipment->getShipment()->getId() && $shipment->getShipment()->getOrder()->getId()) {
                     // Save comments.
                     $shipment->saveComments();
                     // Save modified shipment.
                     $shipment->save();
                 }
                 // Stop processing 10s before we run out of time
                 if ($shipmentOffset < $collection->count() && $maxExecutionTime - 10 < time() - $startTime) {
                     return false;
                 }
             }
         }
     } catch (Exception $e) {
         Mage::logException($e);
         throw new Dhl_Intraship_Model_Soap_Client_Response_Exception($e->getMessage(), $e->getCode());
     }
     return true;
 }
开发者ID:igorvasiliev4,项目名称:magento_code,代码行数:67,代码来源:Gateway.php

示例10: _beforeRepositoryFetch

 /**
  * Check the object cache see if the data has already been retrieved
  * 
  * This cache is only persisted throughout a request 
  *
  * @param KCommandContext $context
  *
  * @return void
  */
 protected function _beforeRepositoryFetch(KCommandContext $context)
 {
     if ($this->_enable) {
         $key = $this->_getCacheKey($context->query);
         if (self::$_cache->offsetExists($key)) {
             $context->data = self::$_cache->offsetGet($key);
             return false;
         }
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:19,代码来源:cachable.php

示例11: getFieldDescriptor

 /**
  * returns field descriptor
  *
  * @throws \VisioCrudModeler\Exception\FieldNotFound
  * @return DbFieldDescriptor
  */
 public function getFieldDescriptor($fieldName)
 {
     if (!array_key_exists($fieldName, $this->definition['fields'])) {
         throw new FieldNotFound("field '" . $fieldName . "' not found in '" . $this->getName() . "'");
     }
     if (!$this->fieldDescriptors->offsetExists($fieldName)) {
         $this->fieldDescriptors->offsetSet($fieldName, new WebFieldDescriptor($this, $this->definition['fields'][$fieldName]));
     }
     return $this->fieldDescriptors->offsetGet($fieldName);
 }
开发者ID:renatosalvatori,项目名称:visio-crud-zf2,代码行数:16,代码来源:WebDataSetDescriptor.php

示例12: get

 /**
  * @param string $index
  * @param null|string $defaultValue
  * @param bool   $filtered If you trust foreign input introduced to your PHP code - set to FALSE!
  *
  * @return string
  */
 public function get($index, $defaultValue = null, $filtered = true)
 {
     if ($this->data->offsetExists($index)) {
         if ($filtered === true) {
             // pretty high-level filtering here...
             return self::filter($this->data->offsetGet($index));
         }
         return $this->data->offsetGet($index);
     }
     return $defaultValue;
 }
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:18,代码来源:Param.php

示例13: get

 /**
  * @param $name
  * @param bool|false $throw_exception
  * @return PluginBootstrap|null
  * @throws PluginManagerException
  */
 public function get($name, $throw_exception = false)
 {
     if (!$this->arrayObject->offsetExists($name)) {
         $this->load($name, $throw_exception);
     }
     if ($this->arrayObject->offsetExists($name)) {
         return $this->arrayObject->offsetGet($name);
     } else {
         return null;
     }
 }
开发者ID:lava83,项目名称:lavaproto,代码行数:17,代码来源:PluginCollection.php

示例14: isClosed

 /**
  * @return bool
  */
 public function isClosed()
 {
     if ($this->points->count() < 3) {
         return false;
     }
     $firstPoint = $this->points->offsetGet(0);
     $lastPoint = $this->points->offsetGet($this->points->count() - 1);
     if ($firstPoint->getX() == $lastPoint->getX() && $firstPoint->getY() == $lastPoint->getY()) {
         return true;
     }
     return false;
 }
开发者ID:pepin82,项目名称:geometry,代码行数:15,代码来源:Points.php

示例15: setDatabases

 public function setDatabases()
 {
     $databases = new ArrayObject();
     foreach ($this->getResponse() as $value) {
         $line = new ArrayObject(explode(':', $value, 2));
         if (strpos($line->offsetGet(0), self::DB_KEY) !== FALSE) {
             preg_match(self::DB_PATTERN, $line->offsetGet(1), $matches);
             $databases->offsetSet($line->offsetGet(0), new ArrayObject($matches));
         }
     }
     $this->databases = $databases;
 }
开发者ID:tin-cat,项目名称:redis-info,代码行数:12,代码来源:Result.php


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