SyntaxErrorException.class.php

Go to the documentation of this file.
00001 <?php
00002 /****************************************************************************
00003  *   Copyright (C) 2008 by Vladlen Y. Koshelev                              *
00004  *                                                                          *
00005  *   This program is free software; you can redistribute it and/or modify   *
00006  *   it under the terms of the GNU Lesser General Public License as         *
00007  *   published by the Free Software Foundation; either version 3 of the     *
00008  *   License, or (at your option) any later version.                        *
00009  *                                                                          *
00010  ****************************************************************************/
00011 
00015     final class SyntaxErrorException extends BaseException
00016     {
00017         private $errorLine      = null;
00018         private $errorPosition  = null;
00019         
00020         public function __construct(
00021             $message, $errorLine = null, $errorPosition = null, $code = 0
00022         )
00023         {
00024             parent::__construct($message, $code);
00025             
00026             $this->errorLine = $errorLine;
00027             $this->errorPosition = $errorPosition;
00028         }
00029         
00030         public function getErrorLine()
00031         {
00032             return $this->errorLine;
00033         }
00034         
00035         public function getErrorPosition()
00036         {
00037             return $this->errorPosition;
00038         }
00039         
00040         public function __toString()
00041         {
00042             return
00043                 '[error at line '
00044                 .(Assert::checkInteger($this->errorLine) ? $this->errorLine : 'unknown')
00045                 .', position '
00046                 .(Assert::checkInteger($this->errorPosition) ? $this->errorPosition : 'unknown')
00047                 .": {$this->message}] in: \n".
00048                 $this->getTraceAsString();
00049         }
00050     }
00051 ?>