# media-cloud-sync/1.2.12/includes/sdk/s3/JmesPath/SyntaxErrorException.php

Media Cloud Sync, version 1.2.12. 26 lines.

- Page: https://pluginprobe.com/plugins/media-cloud-sync/1.2.12/code/includes/sdk/s3/JmesPath/SyntaxErrorException.php
- Raw: https://pluginprobe.com/plugins/media-cloud-sync/1.2.12/raw/includes/sdk/s3/JmesPath/SyntaxErrorException.php
- Modified: 2024-10-27T10:40:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/media-cloud-sync/1.2.12/code/includes/sdk/s3/JmesPath/SyntaxErrorException.php#L10-L20`.

```php
<?php

namespace Dudlewebs\WPMCS\s3\JmesPath;

/**
 * Syntax errors raise this exception that gives context
 */
class SyntaxErrorException extends \InvalidArgumentException
{
    /**
     * @param string $expectedTypesOrMessage Expected array of tokens or message
     * @param array  $token                  Current token
     * @param string $expression             Expression input
     */
    public function __construct($expectedTypesOrMessage, array $token, $expression)
    {
        $message = "Syntax error at character {$token['pos']}\n" . $expression . "\n" . \str_repeat(' ', \max($token['pos'], 0)) . "^\n";
        $message .= !\is_array($expectedTypesOrMessage) ? $expectedTypesOrMessage : $this->createTokenMessage($token, $expectedTypesOrMessage);
        parent::__construct($message);
    }
    private function createTokenMessage(array $token, array $valid)
    {
        return \sprintf('Expected one of the following: %s; found %s "%s"', \implode(', ', \array_keys($valid)), $token['type'], $token['value']);
    }
}

```
