1<?php 2/** 3* Exception thrown if a parse error occurs 4* 5* @license http://www.opensource.org/licenses/mit-license.php The MIT License 6* @copyright Copyright 2010-2014 PhpCss Team 7*/ 8 9namespace PhpCss\Exception { 10 11 use PhpCss; 12 13 /** 14 * Exception thrown if a parse error occurs 15 * 16 * A parse error occurs if certain tokens are expected for further parsing, but 17 * none of them are found on the token stream 18 */ 19 abstract class TokenException extends ParserException { 20 21 /** 22 * The token encountered during the scan. 23 * 24 * This is the token object which was not expected to be found at the given 25 * position. 26 * 27 * @var PhpCss\Scanner\Token 28 */ 29 protected $_encounteredToken; 30 31 public function __construct(PhpCss\Scanner\Token $token, string $message) { 32 $this->_encounteredToken = $token; 33 parent::__construct($message); 34 } 35 36 /** 37 * Return the token that triggered the exception 38 * 39 * @return PhpCss\Scanner\Token 40 */ 41 public function getToken(): PhpCss\Scanner\Token { 42 return $this->_encounteredToken; 43 } 44 } 45} 46