PluginProbe
Media Cloud Sync / 1.2.12
Media Cloud Sync v1.2.12
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / s3 / JmesPath / SyntaxErrorException.php

SyntaxErrorException.php in Media Cloud Sync 1.2.12, at includes/sdk/s3/JmesPath/SyntaxErrorException.php

26 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\JmesPath;
4
5 /**
6 * Syntax errors raise this exception that gives context
7 */
8 class SyntaxErrorException extends \InvalidArgumentException
9 {
10 /**
11 * @param string $expectedTypesOrMessage Expected array of tokens or message
12 * @param array $token Current token
13 * @param string $expression Expression input
14 */
15 public function __construct($expectedTypesOrMessage, array $token, $expression)
16 {
17 $message = "Syntax error at character {$token['pos']}\n" . $expression . "\n" . \str_repeat(' ', \max($token['pos'], 0)) . "^\n";
18 $message .= !\is_array($expectedTypesOrMessage) ? $expectedTypesOrMessage : $this->createTokenMessage($token, $expectedTypesOrMessage);
19 parent::__construct($message);
20 }
21 private function createTokenMessage(array $token, array $valid)
22 {
23 return \sprintf('Expected one of the following: %s; found %s "%s"', \implode(', ', \array_keys($valid)), $token['type'], $token['value']);
24 }
25 }
26