예제 #1
0
 public function testCreatesInstanceFromAlias()
 {
     $alias = new PharAlias('foo', new AnyVersionConstraint());
     $phar = RequestedPhar::fromAlias($alias);
     $this->assertInstanceOf(RequestedPhar::class, $phar);
     $this->assertTrue($phar->isAlias());
     $this->assertSame($alias, $phar->getAlias());
 }
예제 #2
0
 /**
  * @return RequestedPhar[]
  */
 public function getPhars()
 {
     $phars = [];
     /** @var \DOMElement $pharNode */
     foreach ($this->getXPath()->query('//phive:phar') as $pharNode) {
         if ($pharNode->hasAttribute('url')) {
             $phars[] = RequestedPhar::fromUrl(new Url($pharNode->getAttribute('url')));
         } else {
             $phars[] = RequestedPhar::fromAlias($this->getPharAliasFromNode($pharNode));
         }
     }
     return $phars;
 }