1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace Yansongda\Pay;
- use Exception;
- use Symfony\Component\EventDispatcher\EventDispatcher;
- use Symfony\Component\EventDispatcher\EventSubscriberInterface;
- use Symfony\Contracts\EventDispatcher\Event;
- class Events
- {
-
- protected static $dispatcher;
-
- public static function __callStatic($method, $args)
- {
- return call_user_func_array([self::getDispatcher(), $method], $args);
- }
-
- public function __call($method, $args)
- {
- return call_user_func_array([self::getDispatcher(), $method], $args);
- }
-
- public static function setDispatcher(EventDispatcher $dispatcher)
- {
- self::$dispatcher = $dispatcher;
- }
-
- public static function getDispatcher(): EventDispatcher
- {
- if (self::$dispatcher) {
- return self::$dispatcher;
- }
- return self::$dispatcher = self::createDispatcher();
- }
-
- public static function createDispatcher(): EventDispatcher
- {
- return new EventDispatcher();
- }
- }
|