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()); }
/** * @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; }