1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
6: * @package Nette\Templating
7: */
8:
9:
10:
11: /**
12: * The exception occured during template compilation.
13: *
14: * @author David Grudl
15: * @package Nette\Templating
16: */
17: class NTemplateException extends InvalidStateException
18: {
19: /** @var string */
20: public $sourceFile;
21:
22: /** @var int */
23: public $sourceLine;
24:
25:
26: public function __construct($message, $code = 0, $sourceLine = 0)
27: {
28: $this->sourceLine = (int) $sourceLine;
29: parent::__construct($message, $code);
30: }
31:
32:
33: public function setSourceFile($file)
34: {
35: $this->sourceFile = (string) $file;
36: $this->message = rtrim($this->message, '.') . " in " . str_replace(dirname(dirname($file)), '...', $file)
37: . ($this->sourceLine ? ":$this->sourceLine" : '');
38: }
39:
40: }
41: