コード例 #1
0
 /**
  * @dataProvider tokenProvider
  */
 public function testParseRange($version, $tokenList, $expectedRange, $expectedSerialization)
 {
     $comparatorFactory = new ComparatorFactory();
     $versionBuilder = new VersionBuilder(new LabelBuilder());
     $wildcardParser = new WildcardRangeParser($comparatorFactory->get('>='), $comparatorFactory->get('<'));
     $matcherList = array(new CaretRangeParser($comparatorFactory->get('>='), $comparatorFactory->get('<')), new TildeRangeParser($wildcardParser), $wildcardParser, new BranchParser($wildcardParser), new ComparatorVersionParser($comparatorFactory, $versionBuilder), new HyphenatedRangeParser($versionBuilder, $comparatorFactory->get('>='), $comparatorFactory->get('<'), $comparatorFactory->get('<=')));
     $parser = new VersionParser($matcherList);
     $range = $parser->parseRange($tokenList);
     $this->assertEquals($expectedRange, $range);
     $this->assertEquals($expectedSerialization, strval($range));
 }
コード例 #2
0
 /**
  * Parse a version range & return an object implementing VersionRangeInterface that encodes those rules.
  *
  * @param string $rangeString
  *
  * @return VersionRangeInterface
  */
 public function parseRange($rangeString)
 {
     $tokenList = $this->tokenizer->tokenize($rangeString);
     return $this->parser->parseRange($tokenList);
 }