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


PHP ArrayIterator::valid方法代码示例

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


在下文中一共展示了ArrayIterator::valid方法的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: onResponse

 /**
  * Switches to alternate nicks as needed when nick collisions occur.
  *
  * @return void
  */
 public function onResponse()
 {
     // If no alternate nick list was found, return
     if (empty($this->iterator)) {
         return;
     }
     // If the response event indicates that the nick set is in use...
     $code = $this->getEvent()->getCode();
     if ($code == Phergie_Event_Response::ERR_NICKNAMEINUSE) {
         // Attempt to move to the next nick in the alternate nick list
         $this->iterator->next();
         // If another nick is available...
         if ($this->iterator->valid()) {
             // Switch to the new nick
             $altNick = $this->iterator->current();
             $this->doNick($altNick);
             // Update the connection to reflect the nick change
             $this->getConnection()->setNick($altNick);
         } else {
             // If no other nicks are available...
             // Terminate the connection
             $this->doQuit('All specified alternate nicks are in use');
         }
     }
 }
开发者ID:phergie,项目名称:phergie,代码行数:30,代码来源:AltNick.php

示例3: next

 public function next()
 {
     $this->items->next();
     if (!$this->items->valid()) {
         $this->page++;
         $this->load();
     }
 }
开发者ID:renanbr,项目名称:crossref-client,代码行数:8,代码来源:Rows.php

示例4: dayInfo

 private function dayInfo()
 {
     $this->daysInfo = new ArrayIterator();
     while ($this->days->valid()) {
         $day = explode(") - ", $this->days->current());
         $infos = explode("/", $day[1]);
         $this->daysInfo->append($this->buildWeatherDayInfo($day[0], $infos));
         $this->days->next();
     }
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:10,代码来源:WeatherForecast.php

示例5: assertIteratesThrough

 protected function assertIteratesThrough($values, $iterator)
 {
     $valuesIterator = new ArrayIterator($values);
     $valuesIterator->rewind();
     foreach ($iterator as $key => $row) {
         $this->assertTrue($valuesIterator->valid());
         $this->assertEquals($valuesIterator->key(), $key);
         $this->assertEquals($valuesIterator->current(), $row);
         $valuesIterator->next();
     }
     $this->assertFalse($valuesIterator->valid());
 }
开发者ID:jackbzne,项目名称:spreadsheet-parser,代码行数:12,代码来源:CsvTest.php

示例6: proceed

 /**
  * {@inheritDoc}
  */
 public function proceed(CommandMessageInterface $commandProceedWith = null)
 {
     if (null !== $commandProceedWith) {
         $this->command = $commandProceedWith;
     }
     if ($this->chain->valid()) {
         $next = $this->chain->current();
         $this->chain->next();
         return $next->handle($this->command, $this->unitOfWork, $this);
     } else {
         return $this->handler->handle($this->command, $this->unitOfWork);
     }
 }
开发者ID:fcm,项目名称:GovernorFramework,代码行数:16,代码来源:DefaultInterceptorChain.php

示例7: seek

 /**
  * {@inheritdoc}
  */
 public function seek($offset)
 {
     $newIterator = new \ArrayIterator($this->baseArray);
     while ($newIterator->key() != $offset && $newIterator->valid()) {
         $newIterator->next();
     }
     if (!$newIterator->valid()) {
         throw new BadOffsetException("OffsetProvider is not valid", 550);
     }
     if ($newIterator->key() != $offset) {
         throw new \Exception("Something went wrong", 550);
     }
     $this->arrayIterator = $newIterator;
 }
开发者ID:macseem,项目名称:mim,代码行数:17,代码来源:DataArray.php

示例8: nextThing

 /**
  * handles lazy-loading logic
  * @return void
  */
 protected function nextThing()
 {
     if (!$this->iterator->valid()) {
         if ($this->collection->pages == $this->currentPage) {
             $this->row = null;
             return;
         } else {
             $this->currentPage++;
             $this->fetch($this->currentPage);
         }
     }
     $this->row = $this->transformRow($this->iterator->current());
     $this->cursor++;
 }
开发者ID:dreamcommerce,项目名称:appstore-bundle,代码行数:18,代码来源:ResourceListIterator.php

示例9: valid

 /**
  * Checks if the current position of the cache entry iterator is valid.
  *
  * @return boolean TRUE if the current position is valid, otherwise FALSE
  * @api
  */
 public function valid()
 {
     if ($this->cacheEntriesIterator === null) {
         $this->rewind();
     }
     return $this->cacheEntriesIterator->valid();
 }
开发者ID:neos,项目名称:flow-development-collection,代码行数:13,代码来源:PdoBackend.php

示例10: matchesList

 public function matchesList(array $items)
 {
     $itemIterator = new \ArrayIterator($items);
     $matcherIterator = new \ArrayIterator($this->getMatchers());
     $currentMatcher = null;
     if ($matcherIterator->valid()) {
         $currentMatcher = $matcherIterator->current();
     }
     while ($itemIterator->valid() && null !== $currentMatcher) {
         $hasMatch = $currentMatcher->matches($itemIterator->current());
         if ($hasMatch) {
             $matcherIterator->next();
             if ($matcherIterator->valid()) {
                 $currentMatcher = $matcherIterator->current();
             } else {
                 $currentMatcher = null;
             }
         }
         $itemIterator->next();
     }
     //echo sprintf("%s->%s, %s->%s\n", $itemIterator->key(), $itemIterator->count(),
     //      $matcherIterator->key(), $matcherIterator->count());
     if (null !== $currentMatcher && !$currentMatcher->matches(null)) {
         $this->reportFailed($currentMatcher);
         return false;
     }
     $matcherIterator->next();
     return $this->matchRemainder($matcherIterator);
 }
开发者ID:fcm,项目名称:GovernorFramework,代码行数:29,代码来源:SequenceMatcher.php

示例11: valid

 /**
  * je-li v rozsahu pole
  * @return bool
  */
 public function valid()
 {
     if ($this->pointer < 0) {
         return FALSE;
     }
     return parent::valid();
 }
开发者ID:svobodni,项目名称:web,代码行数:11,代码来源:ArrayStep.php

示例12: usu5_base_filename

/**
 * USU5 function to return the base filename
 */
function usu5_base_filename()
{
    // Probably won't get past SCRIPT_NAME unless this is reporting cgi location
    $base = new ArrayIterator(array('SCRIPT_NAME', 'PHP_SELF', 'REQUEST_URI', 'ORIG_PATH_INFO', 'HTTP_X_ORIGINAL_URL', 'HTTP_X_REWRITE_URL'));
    while ($base->valid()) {
        if (array_key_exists($base->current(), $_SERVER) && !empty($_SERVER[$base->current()])) {
            if (false !== strpos($_SERVER[$base->current()], '.php')) {
                // ignore processing if this script is not running in the catalog directory
                if (dirname($_SERVER[$base->current()]) . '/' != DIR_WS_HTTP_CATALOG) {
                    return $_SERVER[$base->current()];
                }
                preg_match('@[a-z0-9_]+\\.php@i', $_SERVER[$base->current()], $matches);
                if (is_array($matches) && array_key_exists(0, $matches) && substr($matches[0], -4, 4) == '.php' && (is_readable($matches[0]) || false !== strpos($_SERVER[$base->current()], 'ext/modules/'))) {
                    return $matches[0];
                }
            }
        }
        $base->next();
    }
    // Some odd server set ups return / for SCRIPT_NAME and PHP_SELF when accessed as mysite.com (no index.php) where they usually return /index.php
    if ($_SERVER['SCRIPT_NAME'] == '/' || $_SERVER['PHP_SELF'] == '/') {
        return HTTP_SERVER;
    }
    trigger_error('USU5 could not find a valid base filename, please inform the developer.', E_USER_WARNING);
}
开发者ID:digideskio,项目名称:oscmax2,代码行数:28,代码来源:application_top.php

示例13: next

 /**
  * Sets the internal pointer on the next element.
  *
  * @return boolean	True, if the map has a next element, false otherwise
  */
 public function next()
 {
     if ($this->initializeIterator()) {
         $this->iterator->next();
     }
     return $this->iterator->valid();
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:12,代码来源:Map.util.php

示例14: zroneClassLoader

/**
 * 自动加载
 *
 * @param $className
 */
function zroneClassLoader($className)
{
    $path = array(str_replace("\\", "/", dirname(__FILE__) . DIRECTORY_SEPARATOR . "Vendor/"), str_replace("\\", "/", dirname(__FILE__) . DIRECTORY_SEPARATOR . "FrameWork/"), str_replace("\\", "/", dirname(__FILE__) . DIRECTORY_SEPARATOR . "Application/"));
    if (isset($path) && is_array($path)) {
        $Iterator = new ArrayIterator($path);
        $Iterator->rewind();
        $pathString = "";
        while ($Iterator->valid()) {
            $pathString .= $Iterator->current() . ";";
            if ($Iterator->key() == count($path) - 1) {
                $pathString = rtrim($pathString, ";");
            }
            $Iterator->next();
        }
        set_include_path($pathString);
        spl_autoload_extensions(".php, .class.php");
        spl_autoload($className);
    } else {
        try {
            throw new Exception("<code style='color: red; font-size: 22px; display: block; text-align: center; height: 40px; line-height: 40px;'>I'm sorry, my dear! The FrameWork is Wrong……😫</code>");
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
}
开发者ID:zrone,项目名称:apiDocument,代码行数:30,代码来源:zroneFrameWork.php

示例15: queryByIC

 /**
  *
  *@param $id_ciu
  *
  *
  **/
 public function queryByIC($id_ciu)
 {
     $this->conex = DataBase::getInstance();
     $stid = oci_parse($this->conex, "SELECT * FROM TBL_REPRESENTANTEEMPRESAS WHERE CLV_REPRESENTANTE=:id_ciu");
     if (!$stid) {
         $e = oci_error($this->conex);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     // Realizar la lógica de la consulta
     oci_bind_by_name($stid, ':id_ciu', $id_ciu);
     $r = oci_execute($stid);
     if (!$r) {
         $e = oci_error($stid);
         trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
     }
     $result = new RepresentanteEmpresa();
     // Obtener los resultados de la consulta
     while ($fila = oci_fetch_array($stid, OCI_ASSOC + OCI_RETURN_NULLS)) {
         $it = new ArrayIterator($fila);
         while ($it->valid()) {
             $result->__SET(strtolower($it->key()), $it->current());
             $it->next();
         }
     }
     //Libera los recursos
     oci_free_statement($stid);
     // Cierra la conexión Oracle
     oci_close($this->conex);
     //retorna el resultado de la consulta
     return $result;
 }
开发者ID:vanckruz,项目名称:draftReports,代码行数:37,代码来源:model_representante.php


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