Verzeichnisstruktur phpBB-3.1.0


Veröffentlicht
27.10.2014

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

ParseException.php

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


 001  <?php
 002   
 003  /*
 004   * This file is part of the Symfony package.
 005   *
 006   * (c) Fabien Potencier <fabien@symfony.com>
 007   *
 008   * For the full copyright and license information, please view the LICENSE
 009   * file that was distributed with this source code.
 010   */
 011   
 012  namespace Symfony\Component\Yaml\Exception;
 013   
 014  if (!defined('JSON_UNESCAPED_UNICODE')) {
 015      define('JSON_UNESCAPED_SLASHES', 64);
 016      define('JSON_UNESCAPED_UNICODE', 256);
 017  }
 018   
 019  /**
 020   * Exception class thrown when an error occurs during parsing.
 021   *
 022   * @author Fabien Potencier <fabien@symfony.com>
 023   *
 024   * @api
 025   */
 026  class ParseException extends RuntimeException
 027  {
 028      private $parsedFile;
 029      private $parsedLine;
 030      private $snippet;
 031      private $rawMessage;
 032   
 033      /**
 034       * Constructor.
 035       *
 036       * @param string    $message    The error message
 037       * @param int       $parsedLine The line where the error occurred
 038       * @param int       $snippet    The snippet of code near the problem
 039       * @param string    $parsedFile The file name where the error occurred
 040       * @param \Exception $previous   The previous exception
 041       */
 042      public function __construct($message, $parsedLine = -1, $snippet = null, $parsedFile = null, \Exception $previous = null)
 043      {
 044          $this->parsedFile = $parsedFile;
 045          $this->parsedLine = $parsedLine;
 046          $this->snippet = $snippet;
 047          $this->rawMessage = $message;
 048   
 049          $this->updateRepr();
 050   
 051          parent::__construct($this->message, 0, $previous);
 052      }
 053   
 054      /**
 055       * Gets the snippet of code near the error.
 056       *
 057       * @return string The snippet of code
 058       */
 059      public function getSnippet()
 060      {
 061          return $this->snippet;
 062      }
 063   
 064      /**
 065       * Sets the snippet of code near the error.
 066       *
 067       * @param string $snippet The code snippet
 068       */
 069      public function setSnippet($snippet)
 070      {
 071          $this->snippet = $snippet;
 072   
 073          $this->updateRepr();
 074      }
 075   
 076      /**
 077       * Gets the filename where the error occurred.
 078       *
 079       * This method returns null if a string is parsed.
 080       *
 081       * @return string The filename
 082       */
 083      public function getParsedFile()
 084      {
 085          return $this->parsedFile;
 086      }
 087   
 088      /**
 089       * Sets the filename where the error occurred.
 090       *
 091       * @param string $parsedFile The filename
 092       */
 093      public function setParsedFile($parsedFile)
 094      {
 095          $this->parsedFile = $parsedFile;
 096   
 097          $this->updateRepr();
 098      }
 099   
 100      /**
 101       * Gets the line where the error occurred.
 102       *
 103       * @return int     The file line
 104       */
 105      public function getParsedLine()
 106      {
 107          return $this->parsedLine;
 108      }
 109   
 110      /**
 111       * Sets the line where the error occurred.
 112       *
 113       * @param int     $parsedLine The file line
 114       */
 115      public function setParsedLine($parsedLine)
 116      {
 117          $this->parsedLine = $parsedLine;
 118   
 119          $this->updateRepr();
 120      }
 121   
 122      private function updateRepr()
 123      {
 124          $this->message = $this->rawMessage;
 125   
 126          $dot = false;
 127          if ('.' === substr($this->message, -1)) {
 128              $this->message = substr($this->message, 0, -1);
 129              $dot = true;
 130          }
 131   
 132          if (null !== $this->parsedFile) {
 133              $this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
 134          }
 135   
 136          if ($this->parsedLine >= 0) {
 137              $this->message .= sprintf(' at line %d', $this->parsedLine);
 138          }
 139   
 140          if ($this->snippet) {
 141              $this->message .= sprintf(' (near "%s")', $this->snippet);
 142          }
 143   
 144          if ($dot) {
 145              $this->message .= '.';
 146          }
 147      }
 148  }
 149