Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
FilterIterator.php
001 <?php
002 /**
003 * Zend Framework (http://framework.zend.com/)
004 *
005 * @link http://github.com/zendframework/zf2 for the canonical source repository
006 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
007 * @license http://framework.zend.com/license/new-bsd New BSD License
008 */
009
010 namespace Zend\EventManager\Filter;
011
012 use Zend\Stdlib\CallbackHandler;
013 use Zend\Stdlib\SplPriorityQueue;
014
015 /**
016 * Specialized priority queue implementation for use with an intercepting
017 * filter chain.
018 *
019 * Allows removal
020 */
021 class FilterIterator extends SplPriorityQueue
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 $chain = clone $this;
032 foreach ($chain as $item) {
033 if ($item === $datum) {
034 return true;
035 }
036 }
037 return false;
038 }
039
040 /**
041 * Remove a value from the queue
042 *
043 * This is an expensive operation. It must first iterate through all values,
044 * and then re-populate itself. Use only if absolutely necessary.
045 *
046 * @param mixed $datum
047 * @return bool
048 */
049 public function remove($datum)
050 {
051 $this->setExtractFlags(self::EXTR_BOTH);
052
053 // Iterate and remove any matches
054 $removed = false;
055 $items = array();
056 $this->rewind();
057 while (!$this->isEmpty()) {
058 $item = $this->extract();
059 if ($item['data'] === $datum) {
060 $removed = true;
061 continue;
062 }
063 $items[] = $item;
064 }
065
066 // Repopulate
067 foreach ($items as $item) {
068 $this->insert($item['data'], $item['priority']);
069 }
070
071 $this->setExtractFlags(self::EXTR_DATA);
072 return $removed;
073 }
074
075 /**
076 * Iterate the next filter in the chain
077 *
078 * Iterates and calls the next filter in the chain.
079 *
080 * @param mixed $context
081 * @param array $params
082 * @param FilterIterator $chain
083 * @return mixed
084 */
085 public function next($context = null, array $params = array(), $chain = null)
086 {
087 if (empty($context) || $chain->isEmpty()) {
088 return;
089 }
090
091 $next = $this->extract();
092 if (!$next instanceof CallbackHandler) {
093 return;
094 }
095
096 $return = call_user_func($next->getCallback(), $context, $params, $chain);
097 return $return;
098 }
099 }
100