コード例 #1
0
 /**
  * @param \DOMElement $element
  *
  * @return PharAlias
  */
 private function getPharAliasFromNode(\DOMElement $element)
 {
     $parser = new VersionConstraintParser();
     if ($element->hasAttribute('version')) {
         $version = $parser->parse($element->getAttribute('version'));
     } else {
         $version = new AnyVersionConstraint();
     }
     return new PharAlias($element->getAttribute('name'), $version);
 }
コード例 #2
0
 /**
  * @dataProvider versionStringProvider
  *
  * @param string            $versionString
  * @param VersionConstraint $expectedConstraint
  */
 public function testReturnsExpectedConstraint($versionString, VersionConstraint $expectedConstraint)
 {
     $parser = new VersionConstraintParser();
     $this->assertEquals($expectedConstraint, $parser->parse($versionString));
 }