1 | <?php |
||
20 | final class VersionRangeParser |
||
21 | { |
||
22 | use ChunkBySeparator; |
||
23 | |||
24 | /** @var LogicalOperatorProcessor */ |
||
25 | private $logicalOperatorProcessor; |
||
26 | |||
27 | /** @var RangeParserInterface[] */ |
||
28 | private $rangeParserList; |
||
29 | |||
30 | /** @var string[] Array of tokens representing logical operators */ |
||
31 | private $operatorTokenList = [ |
||
32 | Token::LOGICAL_AND, |
||
33 | Token::LOGICAL_OR |
||
34 | ]; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * Constructor |
||
39 | * |
||
40 | * @param LogicalOperatorProcessor $logicalOperatorProcessor |
||
41 | * @param RangeParserInterface[] $rangeParserList |
||
42 | */ |
||
43 | 32 | public function __construct( |
|
50 | |||
51 | /** |
||
52 | * Parse a version range. |
||
53 | * |
||
54 | * @param Token[] $tokenList |
||
55 | * |
||
56 | * @return VersionRangeInterface |
||
57 | */ |
||
58 | 32 | public function parseRange(array $tokenList) |
|
78 | |||
79 | /** |
||
80 | * Attempt to parse the token list as a version range into an object implementing VersionRangeInterface |
||
81 | * |
||
82 | * Iterates through the provided range parsers checking to see if they can parse the token list. If they can then we |
||
83 | * call the parse method and return a version range object, otherwise return null. |
||
84 | * |
||
85 | * @param Token[] $tokenList |
||
86 | * |
||
87 | * @return VersionRangeInterface|null |
||
88 | */ |
||
89 | 32 | private function attemptParse(array $tokenList) |
|
101 | } |
||
102 |
Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.