芝麻web文件管理V1.00
编辑当前文件:/home/rejoandoctor/test.joruridoctor.com/vendor/psy/psysh/src/Readline/Hoa/EventListener.php
_source = $source; $this->addIds($ids); return; } /** * Adds acceptable ID (or reset). */ public function addIds(array $ids) { foreach ($ids as $id) { $this->_callables[$id] = []; } } /** * Attaches a callable to a listenable component. */ public function attach(string $listenerId, $callable): self { if (false === $this->listenerExists($listenerId)) { throw new EventException('Cannot listen %s because it is not defined.', 0, $listenerId); } $callable = Xcallable::from($callable); $this->_callables[$listenerId][$callable->getHash()] = $callable; return $this; } /** * Detaches a callable from a listenable component. */ public function detach(string $listenerId, $callable): self { unset($this->_callables[$listenerId][Xcallable::from($callable)->getHash()]); return $this; } /** * Detaches all callables from a listenable component. */ public function detachAll(string $listenerId): self { unset($this->_callables[$listenerId]); return $this; } /** * Checks if a listener exists. */ public function listenerExists(string $listenerId): bool { return \array_key_exists($listenerId, $this->_callables); } /** * Sends/fires a bucket to a listener. */ public function fire(string $listenerId, EventBucket $data): array { if (false === $this->listenerExists($listenerId)) { throw new EventException('Cannot fire on %s because it is not defined.', 1, $listenerId); } $data->setSource($this->_source); $out = []; foreach ($this->_callables[$listenerId] as $callable) { $out[] = $callable($data); } return $out; } }