Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

exception_subscriber.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 1.62 KiB


01  <?php
02  /**
03   *
04   * This file is part of the phpBB Forum Software package.
05   *
06   * @copyright (c) phpBB Limited <https://www.phpbb.com>
07   * @license GNU General Public License, version 2 (GPL-2.0)
08   *
09   * For full copyright and license information, please see
10   * the docs/CREDITS.txt file.
11   *
12   */
13   
14  namespace phpbb\console;
15   
16  use phpbb\exception\exception_interface;
17  use Symfony\Component\Console\ConsoleEvents;
18  use Symfony\Component\Console\Event\ConsoleErrorEvent;
19  use Symfony\Component\EventDispatcher\EventSubscriberInterface;
20   
21  class exception_subscriber implements EventSubscriberInterface
22  {
23      /** @var \phpbb\language\language */
24      protected $language;
25   
26      /**
27       * Constructor.
28       *
29       * @param \phpbb\language\language    $language    Language object
30       */
31      public function __construct(\phpbb\language\language $language)
32      {
33          $this->language = $language;
34      }
35   
36      /**
37       * This listener is run when the ConsoleEvents::ERROR event is triggered.
38       * It translate the error message. If in debug mode the original exception is embedded.
39       *
40       * @param ConsoleErrorEvent $event
41       */
42      public function on_error(ConsoleErrorEvent $event)
43      {
44          $original_exception = $event->getError();
45   
46          if ($original_exception instanceof exception_interface)
47          {
48              $parameters = array_merge([$original_exception->getMessage()], $original_exception->get_parameters());
49              $message = call_user_func_array([$this->language, 'lang'], $parameters);
50   
51              $exception = new \RuntimeException($message , $original_exception->getCode(), $original_exception);
52   
53              $event->setError($exception);
54          }
55      }
56   
57      static public function getSubscribedEvents()
58      {
59          return [
60              ConsoleEvents::ERROR => 'on_error',
61          ];
62      }
63  }
64