initial commit; version 22.5.12042
This commit is contained in:
40
libs/Phpfastcache8/Event/EventManagerDispatcherInterface.php
Normal file
40
libs/Phpfastcache8/Event/EventManagerDispatcherInterface.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of phpFastCache.
|
||||
*
|
||||
* @license MIT License (MIT)
|
||||
*
|
||||
* For full copyright and license information, please see the docs/CREDITS.txt file.
|
||||
*
|
||||
* @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> https://www.phpfastcache.com
|
||||
* @author Georges.L (Geolim4) <contact@geolim4.com>
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Phpfastcache\Event;
|
||||
|
||||
/**
|
||||
* Interface EventInterface
|
||||
* @package Phpfastcache\Event
|
||||
*/
|
||||
interface EventManagerDispatcherInterface
|
||||
{
|
||||
/**
|
||||
* @return EventManagerInterface
|
||||
*/
|
||||
public function getEventManager(): EventManagerInterface;
|
||||
|
||||
/**
|
||||
* @param EventManagerInterface $eventManager
|
||||
* @return mixed
|
||||
*/
|
||||
public function setEventManager(EventManagerInterface $eventManager): self;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasEventManager(): bool;
|
||||
}
|
56
libs/Phpfastcache8/Event/EventManagerDispatcherTrait.php
Normal file
56
libs/Phpfastcache8/Event/EventManagerDispatcherTrait.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of phpFastCache.
|
||||
*
|
||||
* @license MIT License (MIT)
|
||||
*
|
||||
* For full copyright and license information, please see the docs/CREDITS.txt file.
|
||||
*
|
||||
* @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> https://www.phpfastcache.com
|
||||
* @author Georges.L (Geolim4) <contact@geolim4.com>
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Phpfastcache\Event;
|
||||
|
||||
/**
|
||||
* Interface EventInterface
|
||||
* @package Phpfastcache\Event
|
||||
*/
|
||||
trait EventManagerDispatcherTrait
|
||||
{
|
||||
/**
|
||||
* @var EventManagerInterface
|
||||
*/
|
||||
protected $eventManager;
|
||||
|
||||
/**
|
||||
* @return EventManagerInterface
|
||||
*/
|
||||
public function getEventManager(): EventManagerInterface
|
||||
{
|
||||
return $this->eventManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EventManagerInterface $em
|
||||
* @return EventManagerDispatcherInterface
|
||||
*/
|
||||
public function setEventManager(EventManagerInterface $em): EventManagerDispatcherInterface
|
||||
{
|
||||
$this->eventManager = $em;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasEventManager(): bool
|
||||
{
|
||||
return isset($this->eventManager);
|
||||
}
|
||||
}
|
59
libs/Phpfastcache8/Event/EventManagerInterface.php
Normal file
59
libs/Phpfastcache8/Event/EventManagerInterface.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of phpFastCache.
|
||||
*
|
||||
* @license MIT License (MIT)
|
||||
*
|
||||
* For full copyright and license information, please see the docs/CREDITS.txt file.
|
||||
*
|
||||
* @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> https://www.phpfastcache.com
|
||||
* @author Georges.L (Geolim4) <contact@geolim4.com>
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Phpfastcache\Event;
|
||||
|
||||
use BadMethodCallException;
|
||||
use Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Interface EventManagerInterface
|
||||
* @package Phpfastcache\Event
|
||||
*/
|
||||
interface EventManagerInterface
|
||||
{
|
||||
/**
|
||||
* @return self
|
||||
*/
|
||||
public static function getInstance(): self;
|
||||
|
||||
/**
|
||||
* @param string $eventName
|
||||
* @param array ...$args
|
||||
*/
|
||||
public function dispatch(string $eventName, ...$args): void;
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param array $arguments
|
||||
* @throws PhpfastcacheInvalidArgumentException
|
||||
* @throws BadMethodCallException
|
||||
*/
|
||||
public function __call(string $name, array $arguments): void;
|
||||
|
||||
/**
|
||||
* @param callable $callback
|
||||
* @param string $callbackName
|
||||
*/
|
||||
public function onEveryEvents(callable $callback, string $callbackName): void;
|
||||
|
||||
/**
|
||||
* @param string $eventName
|
||||
* @param string $callbackName
|
||||
* @return bool
|
||||
*/
|
||||
public function unbindEventCallback(string $eventName, string $callbackName): bool;
|
||||
}
|
Reference in New Issue
Block a user