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

Syntax.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 1.38 KiB


01  <?php
02   
03  /*
04   * This file is part of Twig.
05   *
06   * (c) 2009 Fabien Potencier
07   * (c) 2009 Armin Ronacher
08   *
09   * For the full copyright and license information, please view the LICENSE
10   * file that was distributed with this source code.
11   */
12   
13  /**
14   * Exception thrown when a syntax error occurs during lexing or parsing of a template.
15   *
16   * @author Fabien Potencier <fabien@symfony.com>
17   */
18  class Twig_Error_Syntax extends Twig_Error
19  {
20      /**
21       * Tweaks the error message to include suggestions.
22       *
23       * @param string $name  The original name of the item that does not exist
24       * @param array  $items An array of possible items
25       */
26      public function addSuggestions($name, array $items)
27      {
28          if (!$alternatives = self::computeAlternatives($name, $items)) {
29              return;
30          }
31   
32          $this->appendMessage(sprintf(' Did you mean "%s"?', implode('", "', $alternatives)));
33      }
34   
35      /**
36       * @internal
37       *
38       * To be merged with the addSuggestions() method in 2.0.
39       */
40      public static function computeAlternatives($name, $items)
41      {
42          $alternatives = array();
43          foreach ($items as $item) {
44              $lev = levenshtein($name, $item);
45              if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) {
46                  $alternatives[$item] = $lev;
47              }
48          }
49          asort($alternatives);
50   
51          return array_keys($alternatives);
52      }
53  }
54