@@ -46,29 +46,29 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - public function getListeners(string $event = null): array |
|
| 50 | - { |
|
| 51 | - if ($event === null) { |
|
| 52 | - return array_filter($this->listeners, fn ($key) => $key !== self::WILDCARD, ARRAY_FILTER_USE_KEY); |
|
| 53 | - } |
|
| 49 | + public function getListeners(string $event = null): array |
|
| 50 | + { |
|
| 51 | + if ($event === null) { |
|
| 52 | + return array_filter($this->listeners, fn ($key) => $key !== self::WILDCARD, ARRAY_FILTER_USE_KEY); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if (! array_key_exists($event, $this->listeners)) { |
|
| 56 | - return []; |
|
| 57 | - } |
|
| 55 | + if (! array_key_exists($event, $this->listeners)) { |
|
| 56 | + return []; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - return $this->listeners[$event] ?? []; |
|
| 60 | - } |
|
| 59 | + return $this->listeners[$event] ?? []; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * {@inheritDoc} |
| 64 | 64 | */ |
| 65 | 65 | public function clearListeners(string $event = null): void |
| 66 | 66 | { |
| 67 | - if ($event === null) { |
|
| 68 | - $this->listeners = array_filter($this->listeners, fn ($key) => $key === self::WILDCARD, ARRAY_FILTER_USE_KEY); |
|
| 69 | - } elseif (array_key_exists($event, $this->listeners)) { |
|
| 70 | - unset($this->listeners[$event]); |
|
| 71 | - } |
|
| 67 | + if ($event === null) { |
|
| 68 | + $this->listeners = array_filter($this->listeners, fn ($key) => $key === self::WILDCARD, ARRAY_FILTER_USE_KEY); |
|
| 69 | + } elseif (array_key_exists($event, $this->listeners)) { |
|
| 70 | + unset($this->listeners[$event]); |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | // $events = array_merge($this->listeners[self::WILDCARD], $this->listeners[$eventName]); |
| 156 | 156 | $events = $this->listeners[$eventName]; |
| 157 | 157 | $result = null; |
| 158 | - ksort($events, SORT_NUMERIC); |
|
| 158 | + ksort($events, SORT_NUMERIC); |
|
| 159 | 159 | |
| 160 | 160 | foreach ($events as $priority) { |
| 161 | 161 | if (! is_array($priority)) { |
@@ -172,12 +172,12 @@ discard block |
||
| 172 | 172 | $result = $callback($event); |
| 173 | 173 | |
| 174 | 174 | if (BLITZ_DEBUG) { |
| 175 | - static::$performanceLog[] = [ |
|
| 176 | - 'start' => $start, |
|
| 177 | - 'end' => microtime(true), |
|
| 178 | - 'event' => strtolower($eventName), |
|
| 179 | - ]; |
|
| 180 | - } |
|
| 175 | + static::$performanceLog[] = [ |
|
| 176 | + 'start' => $start, |
|
| 177 | + 'end' => microtime(true), |
|
| 178 | + 'event' => strtolower($eventName), |
|
| 179 | + ]; |
|
| 180 | + } |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function __construct(protected array $listeners = []) |
| 43 | 43 | { |
| 44 | - if (! array_key_exists(self::WILDCARD, $this->listeners)) { |
|
| 44 | + if (!array_key_exists(self::WILDCARD, $this->listeners)) { |
|
| 45 | 45 | $this->listeners[self::WILDCARD] = []; |
| 46 | 46 | } |
| 47 | 47 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | return array_filter($this->listeners, fn ($key) => $key !== self::WILDCARD, ARRAY_FILTER_USE_KEY); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if (! array_key_exists($event, $this->listeners)) { |
|
| 55 | + if (!array_key_exists($event, $this->listeners)) { |
|
| 56 | 56 | return []; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -76,14 +76,14 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function on(string $event, callable $callback, int $priority = 0): bool |
| 78 | 78 | { |
| 79 | - if (! array_key_exists($event, $this->listeners)) { |
|
| 79 | + if (!array_key_exists($event, $this->listeners)) { |
|
| 80 | 80 | $this->listeners[$event] = []; |
| 81 | 81 | } |
| 82 | - if (! array_key_exists($priority, $this->listeners[$event])) { |
|
| 82 | + if (!array_key_exists($priority, $this->listeners[$event])) { |
|
| 83 | 83 | $this->listeners[$event][$priority] = []; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - if (! in_array($callback, $this->listeners[$event][$priority], true)) { |
|
| 86 | + if (!in_array($callback, $this->listeners[$event][$priority], true)) { |
|
| 87 | 87 | $this->listeners[$event][$priority][] = $callback; |
| 88 | 88 | |
| 89 | 89 | return true; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function off(string $event, callable $callback): bool |
| 107 | 107 | { |
| 108 | - if (! array_key_exists($event, $this->listeners) || ! $this->listeners[$event]) { |
|
| 108 | + if (!array_key_exists($event, $this->listeners) || !$this->listeners[$event]) { |
|
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function emit($event, $target = null, $argv = []) |
| 138 | 138 | { |
| 139 | - if (! ($event instanceof EventInterface)) { |
|
| 139 | + if (!($event instanceof EventInterface)) { |
|
| 140 | 140 | $event = new Event($event, $target, $argv); |
| 141 | 141 | } else { |
| 142 | 142 | if ($target) { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $eventName = $event->getName(); |
| 151 | - if (! array_key_exists($eventName, $this->listeners)) { |
|
| 151 | + if (!array_key_exists($eventName, $this->listeners)) { |
|
| 152 | 152 | $this->listeners[$eventName] = []; |
| 153 | 153 | } |
| 154 | 154 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | ksort($events, SORT_NUMERIC); |
| 159 | 159 | |
| 160 | 160 | foreach ($events as $priority) { |
| 161 | - if (! is_array($priority)) { |
|
| 161 | + if (!is_array($priority)) { |
|
| 162 | 162 | continue; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -123,8 +123,8 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * La classe de cache fournit un moyen simple de stocker et de récupérer |
| 125 | 125 | * données complexes pour plus tard |
| 126 | - * |
|
| 127 | - * @return Cache |
|
| 126 | + * |
|
| 127 | + * @return Cache |
|
| 128 | 128 | */ |
| 129 | 129 | public static function cache(?array $config = null, bool $shared = true): CacheInterface |
| 130 | 130 | { |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | /** |
| 173 | 173 | * Conteneur d'injection de dependances |
| 174 | - * |
|
| 175 | - * @return Container |
|
| 174 | + * |
|
| 175 | + * @return Container |
|
| 176 | 176 | */ |
| 177 | 177 | public static function container(bool $shared = true): ContainerInterface |
| 178 | 178 | { |
@@ -185,8 +185,8 @@ discard block |
||
| 185 | 185 | |
| 186 | 186 | /** |
| 187 | 187 | * Gestionnaire de cookies |
| 188 | - * |
|
| 189 | - * @return CookieManager |
|
| 188 | + * |
|
| 189 | + * @return CookieManager |
|
| 190 | 190 | */ |
| 191 | 191 | public static function cookie(bool $shared = true): CookieManagerInterface |
| 192 | 192 | { |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | 221 | * La classe Encryption fournit un cryptage bidirectionnel. |
| 222 | - * |
|
| 223 | - * @return Encryption |
|
| 222 | + * |
|
| 223 | + * @return Encryption |
|
| 224 | 224 | */ |
| 225 | 225 | public static function encrypter(?array $config = null, bool $shared = false): EncrypterInterface |
| 226 | 226 | { |
@@ -231,15 +231,15 @@ discard block |
||
| 231 | 231 | $config ??= config('encryption'); |
| 232 | 232 | $config = (object) $config; |
| 233 | 233 | $encryption = new Encryption($config); |
| 234 | - $encryption->initialize($config); |
|
| 234 | + $encryption->initialize($config); |
|
| 235 | 235 | |
| 236 | 236 | return static::$instances[Encryption::class] = $encryption; |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
| 240 | 240 | * Gestionnaire d'evenement |
| 241 | - * |
|
| 242 | - * @return EventManager |
|
| 241 | + * |
|
| 242 | + * @return EventManager |
|
| 243 | 243 | */ |
| 244 | 244 | public static function event(bool $shared = true): EventManagerInterface |
| 245 | 245 | { |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | 276 | * Le file locator fournit des methodes utilitaire pour chercher les fichiers non-classes dans les dossiers de namespace. |
| 277 | - * C'est une excelente methode pour charger les 'vues', 'helpers', et 'libraries'. |
|
| 278 | - * |
|
| 279 | - * @return Locator |
|
| 277 | + * C'est une excelente methode pour charger les 'vues', 'helpers', et 'libraries'. |
|
| 278 | + * |
|
| 279 | + * @return Locator |
|
| 280 | 280 | */ |
| 281 | 281 | public static function locator(bool $shared = true): LocatorInterface |
| 282 | 282 | { |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | 306 | * La classe de mail vous permet d'envoyer par courrier électronique via mail, sendmail, SMTP. |
| 307 | - * |
|
| 308 | - * @return Mail |
|
| 307 | + * |
|
| 308 | + * @return Mail |
|
| 309 | 309 | */ |
| 310 | 310 | public static function mail(?array $config = null, bool $shared = true): MailerInterface |
| 311 | 311 | { |
@@ -397,8 +397,8 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | /** |
| 399 | 399 | * Le service Routes est une classe qui permet de construire facilement une collection de routes. |
| 400 | - * |
|
| 401 | - * @return RouteCollection |
|
| 400 | + * |
|
| 401 | + * @return RouteCollection |
|
| 402 | 402 | */ |
| 403 | 403 | public static function routes(bool $shared = true): RouteCollectionInterface |
| 404 | 404 | { |
@@ -412,8 +412,8 @@ discard block |
||
| 412 | 412 | /** |
| 413 | 413 | * La classe Router utilise le tableau de routes d'une RouteCollection et détermine |
| 414 | 414 | * le contrôleur et la méthode corrects à exécuter. |
| 415 | - * |
|
| 416 | - * @return Router |
|
| 415 | + * |
|
| 416 | + * @return Router |
|
| 417 | 417 | */ |
| 418 | 418 | public static function router(?RouteCollection $routes = null, ?ServerRequest $request = null, bool $shared = true): RouterInterface |
| 419 | 419 | { |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | /** |
| 435 | 435 | * Retourne le gestionnaire de session. |
| 436 | - * |
|
| 437 | - * @return Store |
|
| 436 | + * |
|
| 437 | + * @return Store |
|
| 438 | 438 | */ |
| 439 | 439 | public static function session(bool $shared = true): SessionInterface |
| 440 | 440 | { |
@@ -530,8 +530,8 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | /** |
| 532 | 532 | * La classe URI fournit un moyen de modéliser et de manipuler les URI. |
| 533 | - * |
|
| 534 | - * @return Uri |
|
| 533 | + * |
|
| 534 | + * @return Uri |
|
| 535 | 535 | */ |
| 536 | 536 | public static function uri(?string $uri = null, bool $shared = true): UriInterface |
| 537 | 537 | { |