composer package updates
[openemr.git] / vendor / sabberworm / php-css-parser / lib / Sabberworm / CSS / Parsing / UnexpectedTokenException.php
blob0ef881846a48e23b48213f21d8e143e6b42aaf93
1 <?php
3 namespace Sabberworm\CSS\Parsing;
5 /**
6 * Thrown if the CSS parsers encounters a token it did not expect
7 */
8 class UnexpectedTokenException extends SourceException {
9 private $sExpected;
10 private $sFound;
11 // Possible values: literal, identifier, count, expression, search
12 private $sMatchType;
14 public function __construct($sExpected, $sFound, $sMatchType = 'literal', $iLineNo = 0) {
15 $this->sExpected = $sExpected;
16 $this->sFound = $sFound;
17 $this->sMatchType = $sMatchType;
18 $sMessage = "Token “{$sExpected}” ({$sMatchType}) not found. Got “{$sFound}”.";
19 if($this->sMatchType === 'search') {
20 $sMessage = "Search for “{$sExpected}” returned no results. Context: “{$sFound}”.";
21 } else if($this->sMatchType === 'count') {
22 $sMessage = "Next token was expected to have {$sExpected} chars. Context: “{$sFound}”.";
23 } else if($this->sMatchType === 'identifier') {
24 $sMessage = "Identifier expected. Got “{$sFound}”";
25 } else if($this->sMatchType === 'custom') {
26 $sMessage = trim("$sExpected $sFound");
29 parent::__construct($sMessage, $iLineNo);