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


PHP ArrayIterator::offsetExists方法代码示例

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


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

示例1: search

 /**
  *
  * @param <type> $table
  * @param ArrayIterator $params
  * @return ArrayObject
  */
 public function search($table, ArrayIterator $params)
 {
     $this->searchParams = $params;
     $this->join();
     if ($table == "analysis") {
         $this->statements->remove("type_event");
     }
     $statement = "SELECT this_.* " . $this->selectAttributes() . " FROM {$table} this_ ";
     $statement .= $this->join();
     $i = 0;
     $this->searchParams->rewind();
     if ($this->searchParams->count() > 0 && !$this->searchParams->offsetExists('true')) {
         $statement .= " WHERE ";
     }
     while ($this->searchParams->valid()) {
         if ($this->statements->containsKey($this->searchParams->key())) {
             if ($i++ > 0) {
                 $statement .= " AND ";
             }
             $clause = $this->statements->get($this->searchParams->key());
             $statement .= str_replace(":" . $this->searchParams->key(), "'" . $this->searchParams->current() . "'", $clause['where']);
         }
         $this->searchParams->next();
     }
     return $this->getObject($statement . " ORDER BY this_.date DESC, this_.id DESC");
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:32,代码来源:SearchEngine.php

示例2: getParam

 public function getParam($name, $default = null)
 {
     $value = $default;
     if ($this->params->offsetExists($name)) {
         $value = $this->params->offsetGet($name);
     }
     return $value;
 }
开发者ID:artprima,项目名称:ixa-wp-config,代码行数:8,代码来源:EnvironmentConfig.php

示例3: getLocation

 /**
  * @param $locId
  * @return LocationHelper
  * @throws \Exception
  */
 public function getLocation($locId)
 {
     if ($this->locations->offsetExists($locId)) {
         return $this->locations->offsetGet($locId);
     } else {
         return $this->locHelper->factory($locId);
     }
 }
开发者ID:mbabenko21,项目名称:likedimion-game,代码行数:13,代码来源:Supervision.php

示例4: verifyAccess

 public function verifyAccess($name, $resource, $page)
 {
     if (!$this->resources->offsetExists($resource)) {
         return false;
     }
     if (!$this->pages->offsetExists($page)) {
         return false;
     }
     return true;
 }
开发者ID:brenodouglas,项目名称:mvc,代码行数:10,代码来源:Role.php

示例5: offsetExists

 /**
  * \WP_Widget::update_callback(): $old_instance = isset($all_instances[$number]) ? $all_instances[$number] : array();
  * \WP_Widget::display_callback(): if ( array_key_exists( $this->number, $instance ) ) {
  * \WP_Widget::get_settings(): if ( !empty($settings) && !array_key_exists('_multiwidget', $settings) ) {
  *
  * @param int|string $key Array key.
  * @return bool
  */
 public function offsetExists($key)
 {
     if ('_multiwidget' === $key) {
         return true;
     }
     return parent::offsetExists($key);
 }
开发者ID:BE-Webdesign,项目名称:wp-customize-widgets-plus,代码行数:15,代码来源:class-widget-settings.php

示例6: offsetGet

 public function offsetGet($offset)
 {
     $name = $this->_normalizeHeaderName($offset);
     if (!parent::offsetExists($name)) {
         throw new Bringit_Exception("Header '{$name}' not in ");
     }
     return parent::offsetGet($name);
 }
开发者ID:pda,项目名称:bringit,代码行数:8,代码来源:RequestHeader.php

示例7: reflect

 /**
  * Reflect the handle class
  *
  * @param string $class
  * @return Collection\Method
  * @throws Exception\InvalidArgument
  */
 public function reflect($class)
 {
     if (class_exists($class) === false) {
         throw new Exception\InvalidArgument(sprintf($this->exceptions[1], $class), 1);
     }
     // Check if we've already reflected this class
     if (static::$reflections->offsetExists($class)) {
         return static::$reflections->offsetGet($class);
     }
     // Create reflection
     $reflectionClass = new \ReflectionClass($class);
     $reflectionMethods = $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC);
     // Method container
     $methods = new Collection\Method();
     // Loop through the class methods (Only public);
     foreach ($reflectionMethods as $reflectionMethod) {
         // Create method information entity
         $method = new Entity\Method();
         $method->setName($reflectionMethod->getName());
         // Get method parameters
         $reflectionParams = $reflectionMethod->getParameters();
         // Evaluate the method params
         foreach ($reflectionParams as $reflectionParam) {
             // Create parameter information entity
             $parameter = new Entity\Parameter();
             $parameter->setIndex($reflectionParam->getPosition());
             $parameter->setName($reflectionParam->getName());
             $parameter->setRequired($reflectionParam->isDefaultValueAvailable() === false);
             // Only set default value when param is optional
             if ($parameter->getRequired() === false) {
                 $parameter->setDefault($reflectionParam->getDefaultValue());
             }
             // Add the parameter to the container
             $method->addParameter($parameter);
         }
         // Add the method to the method container
         $methods->offsetSet(strtolower($method->getName()), $method);
     }
     // Cache reflection in the runtime
     self::$reflections->offsetSet($class, $methods);
     // Return the methods
     return $methods;
 }
开发者ID:jdolieslager,项目名称:jsonrpc,代码行数:50,代码来源:HandlerReflectionMaker.php

示例8: getPostedFile

 private function getPostedFile($key)
 {
     if (!$this->specsIterator->offsetExists($key)) {
         return null;
     }
     $spec = $this->specsIterator[$key];
     if (is_array($spec)) {
         $this->specsIterator[$key] = new \Barberry\PostedFile($this->readTempFile($spec['tmp_name']), $spec['name']);
     }
     return $this->specsIterator[$key];
 }
开发者ID:lionjsa,项目名称:Barberry,代码行数:11,代码来源:Collection.php

示例9: check

 /**
  * Check input against the Rules configured for this Validator.
  *
  * @param array|object|Persistent $input The input data to check.
  * @param bool $all If true, all rules will be checked even if the field
  * does not exist in the input data.
  *
  * @return bool True if all Rules pass, false otherwise.
  */
 public function check($input, $all = false)
 {
     $data = new \ArrayIterator($input);
     foreach ($this->ruleSet as $field => $rules) {
         if ($all || $data->offsetExists($field)) {
             $fieldValue = $data->offsetExists($field) ? $data->offsetGet($field) : null;
             foreach (explode('|', $rules) as $ruleDef) {
                 $ruleExploded = explode(':', $ruleDef, 2);
                 $rule = $ruleExploded[0];
                 $ruleArgs = isset($ruleExploded[1]) ? explode(',', $ruleExploded[1]) : [];
                 try {
                     Rules::$rule($field, $fieldValue, $ruleArgs);
                 } catch (ValidationFailedException $failure) {
                     $this->addFailure($field, $failure->getMessage(), $failure->getCode());
                     $this->failed = true;
                 }
             }
         }
     }
     $this->checked = true;
     return $this->failed === false;
 }
开发者ID:vgrish,项目名称:tacit,代码行数:31,代码来源:Validator.php

示例10: _getRealOffset

 /**
  * Determines the actual array offset given the input offset.
  *
  * @param string $offset  Input offset.
  *
  * @return string  Real offset or null.
  */
 protected function _getRealOffset($offset)
 {
     /* Optimize: check for base $offset in array first. */
     if (parent::offsetExists($offset)) {
         return $offset;
     }
     foreach (array_keys($this->getArrayCopy()) as $key) {
         if (strcasecmp($key, $offset) === 0) {
             return $key;
         }
     }
     return null;
 }
开发者ID:x59,项目名称:horde-support,代码行数:20,代码来源:CaseInsensitiveArray.php

示例11: getHandler

 /**
  * Get the handler based on the namespace
  *
  * @param string $namespace
  * @return object
  * @throws Exception\ArgumentException
  */
 protected function getHandler($namespace)
 {
     // Chack if namespace has been registered
     if ($this->handlers->offsetExists($namespace) === false) {
         throw new Exception\InvalidArgument(sprintf($this->exceptions[1], $namespace), 1);
     }
     // Create instance when needed
     if ($this->handlerInstances->offsetExists($namespace) === false) {
         $handler = $this->handlers->offsetGet($namespace);
         $this->handlerInstances->offsetSet($namespace, new $handler());
     }
     // Return instance
     return $this->handlerInstances->offsetGet($namespace);
 }
开发者ID:jdolieslager,项目名称:jsonrpc,代码行数:21,代码来源:Server.php

示例12: checkMimeTypes

 /**
  * Verifica o mime type do arquivo
  * @return boolean
  */
 public function checkMimeTypes()
 {
     $fileExtension = $this->getFileExtension();
     $fileMimeType = $this->getMimeTypeFile();
     $oIMines = $this->getMimeTypes()->getIterator();
     $oIExtension = $this->getExtension()->getIterator();
     $valid = new \ArrayIterator();
     while ($oIExtension->valid()) {
         $current = $oIExtension->current();
         if ($oIMines->offsetExists($current)) {
             $valid->offsetSet($current, $oIMines->offsetGet($current));
         }
         $oIExtension->next();
     }
     if ($valid->offsetExists($fileExtension)) {
         $item = $valid->offsetGet($fileExtension);
         if (is_array($item)) {
             if (in_array($fileMimeType, $item)) {
                 return true;
             } else {
                 $this->setMessageError("error_mime_type");
                 return false;
             }
         } else {
             if ($fileMimeType == $item) {
                 return true;
             } else {
                 $this->setMessageError("error_mime_type");
                 return false;
             }
         }
     } else {
         $this->setMessageError("error_mime_type");
         return false;
     }
 }
开发者ID:avandrevitor,项目名称:S9,代码行数:40,代码来源:FileUpload.php

示例13: existIndex

 /**
  * Check if the index exist into container
  * 
  * @param int $index
  * @return boolean
  */
 public function existIndex($index)
 {
     return parent::offsetExists($index);
 }
开发者ID:Eximagen,项目名称:sochi,代码行数:10,代码来源:ProductMinMaxPurchaseList.php

示例14: offsetUnset

 public function offsetUnset($name)
 {
     if (!is_array($name)) {
         return parent::offsetUnset($name);
     } else {
         $key = array_shift($name);
         if (sizeof($name) == 0) {
             return parent::offsetUnset($key);
         } else {
             if (parent::offsetExists($key)) {
                 $object = parent::offsetGet($key);
                 if (is_a($object, 'MutliDimArray')) {
                     $object->offsetUnset($name);
                     if ($object->sizeof() == 0) {
                         parent::offsetUnset($key);
                     }
                 } else {
                     parent::offsetUnset($key);
                 }
             }
         }
     }
 }
开发者ID:xiaoguizhidao,项目名称:magmi-git,代码行数:23,代码来源:multi_dim_array.php

示例15: offsetExists

 /**
  * Check whether an offset exists.
  * 
  * @param mixed $offset
  * @return boolean
  */
 public function offsetExists($offset)
 {
     return $this->iterator->offsetExists($offset);
 }
开发者ID:rejsmont,项目名称:BioSymfony,代码行数:10,代码来源:IndexedFileIterator.php


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