ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
Symfony\Component\Yaml\Exception\ParseException Class Reference

Exception class thrown when an error occurs during parsing. More...

+ Inheritance diagram for Symfony\Component\Yaml\Exception\ParseException:
+ Collaboration diagram for Symfony\Component\Yaml\Exception\ParseException:

Public Member Functions

 __construct ($message, $parsedLine=-1, $snippet=null, $parsedFile=null, \Exception $previous=null)
 Constructor. More...
 
 getSnippet ()
 Gets the snippet of code near the error. More...
 
 setSnippet ($snippet)
 Sets the snippet of code near the error. More...
 
 getParsedFile ()
 Gets the filename where the error occurred. More...
 
 setParsedFile ($parsedFile)
 Sets the filename where the error occurred. More...
 
 getParsedLine ()
 Gets the line where the error occurred. More...
 
 setParsedLine ($parsedLine)
 Sets the line where the error occurred. More...
 

Private Member Functions

 updateRepr ()
 

Private Attributes

 $parsedFile
 
 $parsedLine
 
 $snippet
 
 $rawMessage
 

Detailed Description

Exception class thrown when an error occurs during parsing.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 19 of file ParseException.php.

Constructor & Destructor Documentation

◆ __construct()

Symfony\Component\Yaml\Exception\ParseException::__construct (   $message,
  $parsedLine = -1,
  $snippet = null,
  $parsedFile = null,
\Exception  $previous = null 
)

Constructor.

Parameters
string$messageThe error message
int$parsedLineThe line where the error occurred
int$snippetThe snippet of code near the problem
string$parsedFileThe file name where the error occurred
\Exception$previousThe previous exception

Definition at line 35 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$parsedFile, Symfony\Component\Yaml\Exception\ParseException\$parsedLine, Symfony\Component\Yaml\Exception\ParseException\$snippet, and Symfony\Component\Yaml\Exception\ParseException\updateRepr().

36  {
37  $this->parsedFile = $parsedFile;
38  $this->parsedLine = $parsedLine;
39  $this->snippet = $snippet;
40  $this->rawMessage = $message;
41 
42  $this->updateRepr();
43 
44  parent::__construct($this->message, 0, $previous);
45  }
+ Here is the call graph for this function:

Member Function Documentation

◆ getParsedFile()

Symfony\Component\Yaml\Exception\ParseException::getParsedFile ( )

Gets the filename where the error occurred.

This method returns null if a string is parsed.

Returns
string The filename

Definition at line 76 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$parsedFile.

◆ getParsedLine()

Symfony\Component\Yaml\Exception\ParseException::getParsedLine ( )

Gets the line where the error occurred.

Returns
int The file line

Definition at line 98 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$parsedLine.

◆ getSnippet()

Symfony\Component\Yaml\Exception\ParseException::getSnippet ( )

Gets the snippet of code near the error.

Returns
string The snippet of code

Definition at line 52 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$snippet.

◆ setParsedFile()

Symfony\Component\Yaml\Exception\ParseException::setParsedFile (   $parsedFile)

Sets the filename where the error occurred.

Parameters
string$parsedFileThe filename

Definition at line 86 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$parsedFile, and Symfony\Component\Yaml\Exception\ParseException\updateRepr().

+ Here is the call graph for this function:

◆ setParsedLine()

Symfony\Component\Yaml\Exception\ParseException::setParsedLine (   $parsedLine)

Sets the line where the error occurred.

Parameters
int$parsedLineThe file line

Definition at line 108 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$parsedLine, and Symfony\Component\Yaml\Exception\ParseException\updateRepr().

Referenced by Symfony\Component\Yaml\Parser\parse(), and Symfony\Component\Yaml\Parser\parseValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSnippet()

Symfony\Component\Yaml\Exception\ParseException::setSnippet (   $snippet)

Sets the snippet of code near the error.

Parameters
string$snippetThe code snippet

Definition at line 62 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$snippet, and Symfony\Component\Yaml\Exception\ParseException\updateRepr().

Referenced by Symfony\Component\Yaml\Parser\parse(), and Symfony\Component\Yaml\Parser\parseValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateRepr()

Symfony\Component\Yaml\Exception\ParseException::updateRepr ( )
private

Definition at line 115 of file ParseException.php.

References Symfony\Component\Yaml\Exception\ParseException\$rawMessage.

Referenced by Symfony\Component\Yaml\Exception\ParseException\__construct(), Symfony\Component\Yaml\Exception\ParseException\setParsedFile(), Symfony\Component\Yaml\Exception\ParseException\setParsedLine(), and Symfony\Component\Yaml\Exception\ParseException\setSnippet().

116  {
117  $this->message = $this->rawMessage;
118 
119  $dot = false;
120  if ('.' === substr($this->message, -1)) {
121  $this->message = substr($this->message, 0, -1);
122  $dot = true;
123  }
124 
125  if (null !== $this->parsedFile) {
126  $this->message .= sprintf(' in %s', json_encode($this->parsedFile, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
127  }
128 
129  if ($this->parsedLine >= 0) {
130  $this->message .= sprintf(' at line %d', $this->parsedLine);
131  }
132 
133  if ($this->snippet) {
134  $this->message .= sprintf(' (near "%s")', $this->snippet);
135  }
136 
137  if ($dot) {
138  $this->message .= '.';
139  }
140  }
+ Here is the caller graph for this function:

Field Documentation

◆ $parsedFile

◆ $parsedLine

◆ $rawMessage

Symfony\Component\Yaml\Exception\ParseException::$rawMessage
private

◆ $snippet


The documentation for this class was generated from the following file: