Файловый менеджер - Редактировать - /home/avadvi5/calendar.aeronextgen.com/evenement.zip
Ðазад
PK -_�\ ��� � evenement/README.mdnu �[��� # Événement Événement is a very simple event dispatching library for PHP. It has the same design goals as [Silex](https://silex.symfony.com/) and [Pimple](https://github.com/silexphp/Pimple), to empower the user while staying concise and simple. It is very strongly inspired by the [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) API found in [node.js](http://nodejs.org).  [](https://packagist.org/packages/evenement/evenement) [](https://packagist.org/packages/evenement/evenement/stats) [](https://packagist.org/packages/evenement/evenement) ## Fetch The recommended way to install Événement is [through composer](http://getcomposer.org). By running the following command: $ composer require evenement/evenement ## Usage ### Creating an Emitter ```php <?php $emitter = new Evenement\EventEmitter(); ``` ### Adding Listeners ```php <?php $emitter->on('user.created', function (User $user) use ($logger) { $logger->log(sprintf("User '%s' was created.", $user->getLogin())); }); ``` ### Removing Listeners ```php <?php $emitter->removeListener('user.created', function (User $user) use ($logger) { $logger->log(sprintf("User '%s' was created.", $user->getLogin())); }); ``` ### Emitting Events ```php <?php $emitter->emit('user.created', [$user]); ``` Tests ----- $ ./vendor/bin/phpunit License ------- MIT, see LICENSE. PK -_�\�{I= evenement/LICENSEnu �[��� Copyright (c) 2011 Igor Wiedler Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK -_�\��ٌ � evenement/src/error_lognu �[��� [12-May-2025 17:25:23 UTC] PHP Fatal error: Trait "Evenement\EventEmitterTrait" not found in /home/avadvi5/calendar.aeronextgen.com/davis/vendor/evenement/evenement/src/EventEmitter.php on line 14 [14-May-2025 01:10:26 UTC] PHP Fatal error: Trait "Evenement\EventEmitterTrait" not found in /home/avadvi5/calendar.aeronextgen.com/davis/vendor/evenement/evenement/src/EventEmitter.php on line 14 PK -_�\K�mr # evenement/src/EventEmitterTrait.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of Evenement. * * (c) Igor Wiedler <igor@wiedler.ch> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Evenement; use InvalidArgumentException; use function count; use function array_keys; use function array_merge; use function array_search; use function array_unique; use function array_values; trait EventEmitterTrait { protected $listeners = []; protected $onceListeners = []; public function on($event, callable $listener) { if ($event === null) { throw new InvalidArgumentException('event name must not be null'); } if (!isset($this->listeners[$event])) { $this->listeners[$event] = []; } $this->listeners[$event][] = $listener; return $this; } public function once($event, callable $listener) { if ($event === null) { throw new InvalidArgumentException('event name must not be null'); } if (!isset($this->onceListeners[$event])) { $this->onceListeners[$event] = []; } $this->onceListeners[$event][] = $listener; return $this; } public function removeListener($event, callable $listener) { if ($event === null) { throw new InvalidArgumentException('event name must not be null'); } if (isset($this->listeners[$event])) { $index = array_search($listener, $this->listeners[$event], true); if (false !== $index) { unset($this->listeners[$event][$index]); if (count($this->listeners[$event]) === 0) { unset($this->listeners[$event]); } } } if (isset($this->onceListeners[$event])) { $index = array_search($listener, $this->onceListeners[$event], true); if (false !== $index) { unset($this->onceListeners[$event][$index]); if (count($this->onceListeners[$event]) === 0) { unset($this->onceListeners[$event]); } } } } public function removeAllListeners($event = null) { if ($event !== null) { unset($this->listeners[$event]); } else { $this->listeners = []; } if ($event !== null) { unset($this->onceListeners[$event]); } else { $this->onceListeners = []; } } public function listeners($event = null): array { if ($event === null) { $events = []; $eventNames = array_unique( array_merge( array_keys($this->listeners), array_keys($this->onceListeners) ) ); foreach ($eventNames as $eventName) { $events[$eventName] = array_merge( isset($this->listeners[$eventName]) ? $this->listeners[$eventName] : [], isset($this->onceListeners[$eventName]) ? $this->onceListeners[$eventName] : [] ); } return $events; } return array_merge( isset($this->listeners[$event]) ? $this->listeners[$event] : [], isset($this->onceListeners[$event]) ? $this->onceListeners[$event] : [] ); } public function emit($event, array $arguments = []) { if ($event === null) { throw new InvalidArgumentException('event name must not be null'); } $listeners = []; if (isset($this->listeners[$event])) { $listeners = array_values($this->listeners[$event]); } $onceListeners = []; if (isset($this->onceListeners[$event])) { $onceListeners = array_values($this->onceListeners[$event]); } if(empty($listeners) === false) { foreach ($listeners as $listener) { $listener(...$arguments); } } if(empty($onceListeners) === false) { unset($this->onceListeners[$event]); foreach ($onceListeners as $listener) { $listener(...$arguments); } } } } PK -_�\����_ _ evenement/src/EventEmitter.phpnu �[��� <?php declare(strict_types=1); /* * This file is part of Evenement. * * (c) Igor Wiedler <igor@wiedler.ch> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Evenement; class EventEmitter implements EventEmitterInterface { use EventEmitterTrait; } PK -_�\�|�x x '