Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

UndefinedMethodFatalErrorHandler.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 1.81 KiB


01  <?php
02   
03  /*
04   * This file is part of the Symfony package.
05   *
06   * (c) Fabien Potencier <fabien@symfony.com>
07   *
08   * For the full copyright and license information, please view the LICENSE
09   * file that was distributed with this source code.
10   */
11   
12  namespace Symfony\Component\Debug\FatalErrorHandler;
13   
14  use Symfony\Component\Debug\Exception\FatalErrorException;
15  use Symfony\Component\Debug\Exception\UndefinedMethodException;
16   
17  /**
18   * ErrorHandler for undefined methods.
19   *
20   * @author Grégoire Pineau <lyrixx@lyrixx.info>
21   */
22  class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
23  {
24      /**
25       * {@inheritdoc}
26       */
27      public function handleError(array $error, FatalErrorException $exception)
28      {
29          preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
30          if (!$matches) {
31              return;
32          }
33   
34          $className = $matches[1];
35          $methodName = $matches[2];
36   
37          $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
38   
39          $candidates = array();
40          foreach (get_class_methods($className) as $definedMethodName) {
41              $lev = levenshtein($methodName, $definedMethodName);
42              if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
43                  $candidates[] = $definedMethodName;
44              }
45          }
46   
47          if ($candidates) {
48              sort($candidates);
49              $last = array_pop($candidates).'"?';
50              if ($candidates) {
51                  $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
52              } else {
53                  $candidates = '"'.$last;
54              }
55              $message .= "\nDid you mean to call ".$candidates;
56          }
57   
58          return new UndefinedMethodException($message, $exception);
59      }
60  }
61