1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Cloudstek\SCIM\FilterParser; |
6
|
|
|
|
7
|
|
|
use Cloudstek\SCIM\FilterParser\Exception\UnexpectedValueException; |
8
|
|
|
use Nette\Tokenizer; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* SCIM Path Parser. |
12
|
|
|
*/ |
13
|
|
|
class PathParser extends AbstractParser implements PathParserInterface |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* SCIM Path Parser. |
17
|
|
|
*/ |
18
|
|
|
public function __construct() |
19
|
|
|
{ |
20
|
|
|
parent::__construct(ParserMode::PATH); |
|
|
|
|
21
|
|
|
} |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Parse path string. |
25
|
|
|
* |
26
|
|
|
* @param string $input Attribute path.. |
27
|
|
|
* |
28
|
|
|
* @throws Tokenizer\Exception |
29
|
|
|
* |
30
|
|
|
* @return AST\Path |
31
|
|
|
*/ |
32
|
|
|
public function parse(string $input): AST\Path |
33
|
|
|
{ |
34
|
|
|
$stream = $this->tokenizer->tokenize($input); |
35
|
|
|
|
36
|
|
|
// Attribute path |
37
|
|
|
$attributePath = $this->parseAttributePath($stream); |
38
|
|
|
|
39
|
|
|
if ($stream->nextToken() !== null) { |
40
|
|
|
throw new UnexpectedValueException($stream); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
return $attributePath; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @inheritDoc |
48
|
|
|
*/ |
49
|
|
|
protected function parseInner(Tokenizer\Stream $stream, bool $inValuePath = false): ?AST\Node |
50
|
|
|
{ |
51
|
|
|
// @codeCoverageIgnoreStart |
52
|
|
|
if ($inValuePath === false) { |
53
|
|
|
throw new \LogicException('This method should only be called when parsing a value path.'); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
// @codeCoverageIgnoreEnd |
57
|
|
|
|
58
|
|
|
return parent::parseInner($stream, $inValuePath); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @inheritDoc |
63
|
|
|
*/ |
64
|
|
|
protected function parseValuePath(Tokenizer\Stream $stream, AST\AttributePath $attributePath): AST\ValuePath |
65
|
|
|
{ |
66
|
|
|
$valuePath = parent::parseValuePath($stream, $attributePath); |
67
|
|
|
|
68
|
|
|
// Sub attribute |
69
|
|
|
if ($stream->isNext()) { |
70
|
|
|
$subAttr = $stream->consumeToken(self::T_SUBATTR)->value; |
71
|
|
|
|
72
|
|
|
// Strip off the '.' at the start |
73
|
|
|
$subAttr = ltrim($subAttr, '.'); |
74
|
|
|
|
75
|
|
|
// Append to attribute path. |
76
|
|
|
$names = $attributePath->getNames(); |
77
|
|
|
$names[] = $subAttr; |
78
|
|
|
|
79
|
|
|
$valuePath->setAttributePath( |
80
|
|
|
new AST\AttributePath( |
81
|
|
|
$attributePath->getSchema(), |
82
|
|
|
$names |
83
|
|
|
) |
84
|
|
|
); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
return $valuePath; |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths