Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

FilterIterator.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 3.07 KiB


 001  <?php
 002  /**
 003   * Zend Framework (http://framework.zend.com/)
 004   *
 005   * @link      http://github.com/zendframework/zend-eventmanager for the canonical source repository
 006   * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 007   * @license   https://github.com/zendframework/zend-eventmanager/blob/master/LICENSE.md
 008   */
 009   
 010  namespace Zend\EventManager\Filter;
 011   
 012  use Zend\EventManager\Exception;
 013  use Zend\Stdlib\FastPriorityQueue;
 014   
 015  /**
 016   * Specialized priority queue implementation for use with an intercepting
 017   * filter chain.
 018   *
 019   * Allows removal
 020   */
 021  class FilterIterator extends FastPriorityQueue
 022  {
 023      /**
 024       * Does the queue contain a given value?
 025       *
 026       * @param  mixed $datum
 027       * @return bool
 028       */
 029      public function contains($datum)
 030      {
 031          foreach ($this as $item) {
 032              if ($item === $datum) {
 033                  return true;
 034              }
 035          }
 036          return false;
 037      }
 038   
 039      /**
 040       * Insert a value into the queue.
 041       *
 042       * Requires a callable.
 043       *
 044       * @param callable $value
 045       * @param mixed $priority
 046       * @return void
 047       * @throws Exception\InvalidArgumentException for non-callable $value.
 048       */
 049      public function insert($value, $priority)
 050      {
 051          if (! is_callable($value)) {
 052              throw new Exception\InvalidArgumentException(sprintf(
 053                  '%s can only aggregate callables; received %s',
 054                  __CLASS__,
 055                  (is_object($value) ? get_class($value) : gettype($value))
 056              ));
 057          }
 058          parent::insert($value, $priority);
 059      }
 060   
 061      /**
 062       * Remove a value from the queue
 063       *
 064       * This is an expensive operation. It must first iterate through all values,
 065       * and then re-populate itself. Use only if absolutely necessary.
 066       *
 067       * @param  mixed $datum
 068       * @return bool
 069       */
 070      public function remove($datum)
 071      {
 072          $this->setExtractFlags(self::EXTR_BOTH);
 073   
 074          // Iterate and remove any matches
 075          $removed = false;
 076          $items   = [];
 077          $this->rewind();
 078          while (! $this->isEmpty()) {
 079              $item = $this->extract();
 080              if ($item['data'] === $datum) {
 081                  $removed = true;
 082                  continue;
 083              }
 084              $items[] = $item;
 085          }
 086   
 087          // Repopulate
 088          foreach ($items as $item) {
 089              $this->insert($item['data'], $item['priority']);
 090          }
 091   
 092          $this->setExtractFlags(self::EXTR_DATA);
 093          return $removed;
 094      }
 095   
 096      /**
 097       * Iterate the next filter in the chain
 098       *
 099       * Iterates and calls the next filter in the chain.
 100       *
 101       * @param  mixed $context
 102       * @param  array $params
 103       * @param  FilterIterator $chain
 104       * @return mixed
 105       */
 106      public function next($context = null, array $params = [], $chain = null)
 107      {
 108          if (empty($context) || ($chain instanceof FilterIterator && $chain->isEmpty())) {
 109              return;
 110          }
 111   
 112          //We can't extract from an empty heap
 113          if ($this->isEmpty()) {
 114              return;
 115          }
 116   
 117          $next = $this->extract();
 118          return $next($context, $params, $chain);
 119      }
 120  }
 121