-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSyntaxErrorException.php
54 lines (42 loc) · 1.04 KB
/
SyntaxErrorException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
namespace Qubus\View;
use Qubus\Exception\BaseException;
use Qubus\Exception\Exception;
final class SyntaxErrorException extends Exception
{
protected Token $token;
protected string $path;
/**
* @throws BaseException
*/
public function __construct(string $message, Token $token)
{
$this->token = $token;
$line = $token->getLine();
$char = $token->getChar();
parent::__construct(sprintf("$message in line %s char %d", $line, $char));
}
public function setTemplateFile($path): SyntaxErrorException
{
$this->path = $path;
return $this;
}
public function getTemplateFile(): string
{
return $this->path;
}
public function __toString(): string
{
return (string) $this->message;
}
public function setMessage($message): SyntaxErrorException
{
$this->message = $message;
return $this;
}
public function getToken(): Token
{
return $this->token;
}
}