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


PHP SplQueue::rewind方法代码示例

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


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

示例1: route

 /**
  * Runs through all the routes and runs them
  * @author Tim Perry
  */
 public function route()
 {
     $this->routes->rewind();
     while ($this->routes->valid()) {
         $route = $this->routes->current();
         if ($route->run()) {
             return;
         }
         $this->routes->next();
     }
     throw new \RuntimeException("FlexPress router: No route found - please make sure you have setup routes.");
 }
开发者ID:flexpress,项目名称:component-routing,代码行数:16,代码来源:Router.php

示例2: processMiddlewares

 /**
  * Flow through the stack of middlewares
  *
  * @param $id
  * @param $service
  * @return null|object
  */
 protected function processMiddlewares($id, $service)
 {
     $next = new Next($this, clone $this->middlewares);
     $service = $next($id, $service);
     $this->middlewares->rewind();
     return $service;
 }
开发者ID:mrferos,项目名称:GenieDi,代码行数:14,代码来源:Container.php

示例3: run

 /**
  * Runs through all the callable functions provided, if all are met call the given callable
  * @author Tim Perry
  */
 public function run()
 {
     if (!isset($this->conditions) || !isset($this->callable)) {
         $message = "You have called the run function but have not provided both a array of conditions";
         $message .= " and a callable function, which will be called if all the given conditions are met.";
         throw new \RuntimeException($message);
     }
     $this->conditions->rewind();
     while ($this->conditions->valid()) {
         $condition = $this->conditions->current();
         if (!call_user_func($condition)) {
             return false;
         }
         $this->conditions->next();
     }
     call_user_func($this->callable, $this->request);
     return true;
 }
开发者ID:flexpress,项目名称:component-routing,代码行数:22,代码来源:Route.php

示例4: call

 /**
  * 调用 middleware
  *
  * @return mixed
  */
 public function call()
 {
     $this->queue->rewind();
     while ($this->queue->valid()) {
         if ($this->getPropagation()) {
             break;
         }
         $callbale = $this->queue->current();
         $response = call_user_func_array($callbale, func_get_args());
         if ($response === false) {
             break;
         } elseif (!empty($response)) {
             $this->response = $response;
         }
         $this->queue->next();
     }
     return $this->response;
 }
开发者ID:icodechef,项目名称:Lime,代码行数:23,代码来源:Middleware.php

示例5: StringifyBreadcrumbs

 /**
  * Return breadcrumb string
  **/
 function StringifyBreadcrumbs()
 {
     $output = "<ul class=\"breadcrumb\" id=\"breadcrumb\">";
     if (0 != $this->GetConfigValue('enable_breadcrumbs') && isset($_SESSION['user']) && isset($_SESSION['breadcrumbs'])) {
         $delimiter = $this->GetConfigValue('breadcrumb_node_delimiter');
         $q = new SplQueue();
         $q->unserialize($_SESSION['breadcrumbs']);
         $q->rewind();
         $output .= "<li>";
         $output .= "<a href=\"" . $this->Href('', $q->current()) . "\">" . $q->current() . "</a>";
         $q->next();
         while ($q->valid()) {
             $output .= " {$delimiter} ";
             $output .= "</li><li>";
             $output .= "<a href=\"" . $this->Href('', $q->current()) . "\">" . $q->current() . "</a>";
             $q->next();
         }
         $output .= "</li></ul>";
     }
     return $output;
 }
开发者ID:freebasic,项目名称:fbwikka,代码行数:24,代码来源:Wakka.class.php

示例6: serveronly

$qoperatingsystems = new SplQueue();
$qoperatingsystems->push(array('Windows 7', 'desktop', 'NT', 56.11));
$qoperatingsystems->push(array('Windows XP', 'desktop', 'NT', 10.59));
$qoperatingsystems->push(array('Windows 8', 'desktop', 'NT', 2.88));
$qoperatingsystems->push(array('Windows 8.1', 'desktop', 'NT', 11.15));
$qoperatingsystems->push(array('Windows 10', 'desktop', 'NT', 9));
$qoperatingsystems->push(array('Windows Vista', 'desktop', 'NT', 0));
$qoperatingsystems->push(array('Mac OS X 11', 'desktop', 'Unix', 2.66));
$qoperatingsystems->push(array('Mac OS X 10', 'desktop', 'Unix', 2.45));
$qoperatingsystems->push(array('Linux Mint', 'desktop', 'Linux', 0));
$qoperatingsystems->push(array('Linux Debian', 'desktop', 'Linux', 0));
$qoperatingsystems->push(array('Android', 'mobile', 'Linux', 48.12));
$qoperatingsystems->push(array('iOS', 'mobile', 'Unix', 34.71));
echo "\nSPL QUEUE ARRAY FOR LOOP: FIFO\n";
$qoperatingsystems->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO);
for ($qoperatingsystems->rewind(); $qoperatingsystems->valid(); $qoperatingsystems->next()) {
    echo $qoperatingsystems->current()[0] . "\n";
    echo $qoperatingsystems->current()[1] . "\n";
    echo $qoperatingsystems->current()[2] . "\n";
    echo $qoperatingsystems->current()[3] . "\n";
}
/* ------------------BASIC OPERATIONS------------------ */
// SORT
// BY LANGUAGE RANKING
usort($nlanguages, function ($a, $b) {
    return $b[2] - $a[2];
});
// FILTER
// BY DATABASE SIZE
function serveronly($var)
{
开发者ID:ParfaitG,项目名称:DATA_STRUCTURES,代码行数:31,代码来源:DataStructures.php

示例7: bufferValid

/**
 * Determines if we have a valid buffer for optimising.
 *
 * Has to be G1s all round with no Z movements, and either all extrusions or all movements.
 *
 * The extrusions also have to be the same mm^3/mm along the path.
 *
 * They also have to describe a circle
 * @param  SplQueue $buffer The buffer
 * @return Boolean          Whether the buffer is valid
 */
function bufferValid($buffer)
{
    global $debug;
    global $pos_error;
    for ($buffer->rewind(); $buffer->valid(); $buffer->next()) {
        if (substr($buffer->current(), 0, 2) !== "G1") {
            $buffer->rewind();
            return false;
        } else {
            if (strpos($buffer->current(), "Z") !== FALSE) {
                $buffer->rewind();
                return false;
            }
        }
    }
    $lines = getLines($buffer);
    $allE = false;
    $allF = false;
    if (!is_null($lines[0]['E'])) {
        $allE = true;
    }
    if (!is_null($lines[0]['F'])) {
        $allF = true;
    }
    foreach ($lines as $num => $line) {
        $allE = $allE && is_null($line['F']) && !is_null($line['E']);
        $allF = $allF && is_null($line['E']) && !is_null($line['F']);
    }
    if (!($allE || $allF)) {
        $buffer->rewind();
        return false;
    }
    if ($allE) {
        $extrusions = getExtrusionLengths($lines);
        $eerror = calculateExtrusionError($extrusions);
        if (calculateExtrusionError($extrusions) === false) {
            $buffer->rewind();
            return false;
        }
    }
    $lines->rewind();
    $circle = getCircle($lines);
    if ($circle === false) {
        $buffer->rewind();
        return false;
    }
    if (max($circle['errors']) > $pos_error) {
        return false;
    }
    $buffer->rewind();
    return $circle;
}
开发者ID:furynick,项目名称:GCodeArcOptimiser,代码行数:63,代码来源:functions.php

示例8: rewind

 /**
  * Rewind the Iterator to the first element
  * @link http://php.net/manual/en/iterator.rewind.php
  */
 public function rewind()
 {
     $this->queue->rewind();
 }
开发者ID:colonB,项目名称:Copycat,代码行数:8,代码来源:HashQueue.php


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