Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
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 |
FilterChain.php
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;
011
012 /**
013 * FilterChain: intercepting filter manager
014 */
015 class FilterChain implements Filter\FilterInterface
016 {
017 /**
018 * @var Filter\FilterIterator All filters
019 */
020 protected $filters;
021
022 /**
023 * Constructor
024 *
025 * Initializes Filter\FilterIterator in which filters will be aggregated
026 */
027 public function __construct()
028 {
029 $this->filters = new Filter\FilterIterator();
030 }
031
032 /**
033 * Apply the filters
034 *
035 * Begins iteration of the filters.
036 *
037 * @param mixed $context Object under observation
038 * @param mixed $argv Associative array of arguments
039 * @return mixed
040 */
041 public function run($context, array $argv = [])
042 {
043 $chain = clone $this->getFilters();
044
045 if ($chain->isEmpty()) {
046 return;
047 }
048
049 $next = $chain->extract();
050
051 return $next($context, $argv, $chain);
052 }
053
054 /**
055 * Connect a filter to the chain
056 *
057 * @param callable $callback PHP Callback
058 * @param int $priority Priority in the queue at which to execute;
059 * defaults to 1 (higher numbers == higher priority)
060 * @return CallbackHandler (to allow later unsubscribe)
061 * @throws Exception\InvalidCallbackException
062 */
063 public function attach(callable $callback, $priority = 1)
064 {
065 $this->filters->insert($callback, $priority);
066 return $callback;
067 }
068
069 /**
070 * Detach a filter from the chain
071 *
072 * @param callable $filter
073 * @return bool Returns true if filter found and unsubscribed; returns false otherwise
074 */
075 public function detach(callable $filter)
076 {
077 return $this->filters->remove($filter);
078 }
079
080 /**
081 * Retrieve all filters
082 *
083 * @return Filter\FilterIterator
084 */
085 public function getFilters()
086 {
087 return $this->filters;
088 }
089
090 /**
091 * Clear all filters
092 *
093 * @return void
094 */
095 public function clearFilters()
096 {
097 $this->filters = new Filter\FilterIterator();
098 }
099
100 /**
101 * Return current responses
102 *
103 * Only available while the chain is still being iterated. Returns the
104 * current ResponseCollection.
105 *
106 * @return null|ResponseCollection
107 */
108 public function getResponses()
109 {
110 return;
111 }
112 }
113