PluginProbe
WindPress – Tailwind CSS integration for WordPress / 3.2.86
WindPress – Tailwind CSS integration for WordPress v3.2.86
3.2.90 3.2.89 3.2.88 3.2.87 3.2.86 3.2.85 3.2.84 3.2.83 3.2.82 3.2.81 trunk 3.0.0 3.0.1 3.0.10 3.0.11 3.0.12 3.0.13 3.0.14 3.0.15 3.0.16 3.0.17 3.0.2 3.0.3 3.0.4 3.0.5 All 144 releases
windpress / vendor / symfony / yaml / Exception / ParseException.php

ParseException.php in WindPress – Tailwind CSS integration for WordPress 3.2.86, at vendor/symfony/yaml/Exception/ParseException.php

114 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace WindPressDeps\Symfony\Component\Yaml\Exception;
12
13 /**
14 * Exception class thrown when an error occurs during parsing.
15 *
16 * @author Fabien Potencier <fabien@symfony.com>
17 */
18 class ParseException extends RuntimeException
19 {
20 private $parsedFile;
21 private $parsedLine;
22 private $snippet;
23 private $rawMessage;
24 /**
25 * @param string $message The error message
26 * @param int $parsedLine The line where the error occurred
27 * @param string|null $snippet The snippet of code near the problem
28 * @param string|null $parsedFile The file name where the error occurred
29 */
30 public function __construct(string $message, int $parsedLine = -1, ?string $snippet = null, ?string $parsedFile = null, ?\Throwable $previous = null)
31 {
32 $this->parsedFile = $parsedFile;
33 $this->parsedLine = $parsedLine;
34 $this->snippet = $snippet;
35 $this->rawMessage = $message;
36 $this->updateRepr();
37 parent::__construct($this->message, 0, $previous);
38 }
39 /**
40 * Gets the snippet of code near the error.
41 *
42 * @return string
43 */
44 public function getSnippet()
45 {
46 return $this->snippet;
47 }
48 /**
49 * Sets the snippet of code near the error.
50 */
51 public function setSnippet(string $snippet)
52 {
53 $this->snippet = $snippet;
54 $this->updateRepr();
55 }
56 /**
57 * Gets the filename where the error occurred.
58 *
59 * This method returns null if a string is parsed.
60 *
61 * @return string
62 */
63 public function getParsedFile()
64 {
65 return $this->parsedFile;
66 }
67 /**
68 * Sets the filename where the error occurred.
69 */
70 public function setParsedFile(string $parsedFile)
71 {
72 $this->parsedFile = $parsedFile;
73 $this->updateRepr();
74 }
75 /**
76 * Gets the line where the error occurred.
77 *
78 * @return int
79 */
80 public function getParsedLine()
81 {
82 return $this->parsedLine;
83 }
84 /**
85 * Sets the line where the error occurred.
86 */
87 public function setParsedLine(int $parsedLine)
88 {
89 $this->parsedLine = $parsedLine;
90 $this->updateRepr();
91 }
92 private function updateRepr()
93 {
94 $this->message = $this->rawMessage;
95 $dot = \false;
96 if ('.' === substr($this->message, -1)) {
97 $this->message = substr($this->message, 0, -1);
98 $dot = \true;
99 }
100 if (null !== $this->parsedFile) {
101 $this->message .= sprintf(' in %s', json_encode($this->parsedFile, \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE));
102 }
103 if ($this->parsedLine >= 0) {
104 $this->message .= sprintf(' at line %d', $this->parsedLine);
105 }
106 if ($this->snippet) {
107 $this->message .= sprintf(' (near "%s")', $this->snippet);
108 }
109 if ($dot) {
110 $this->message .= '.';
111 }
112 }
113 }
114