本文整理匯總了PHP中Composer\Package\Version\VersionParser::isDev方法的典型用法代碼示例。如果您正苦於以下問題:PHP VersionParser::isDev方法的具體用法?PHP VersionParser::isDev怎麽用?PHP VersionParser::isDev使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Composer\Package\Version\VersionParser
的用法示例。
在下文中一共展示了VersionParser::isDev方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
/**
* Creates a new in memory package.
*
* @param string $name The package's name
* @param string $version The package's version
* @param string $prettyVersion The package's non-normalized version
*/
public function __construct($name, $version, $prettyVersion)
{
parent::__construct($name);
$this->version = $version;
$this->prettyVersion = $prettyVersion;
$this->dev = VersionParser::isDev($version);
}
示例2: __construct
/**
* All descendants' constructors should call this parent constructor
*
* @param PackageInterface $aliasOf The package this package is an alias of
* @param string $version The version the alias must report
* @param string $prettyVersion The alias's non-normalized version
*/
public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
{
parent::__construct($aliasOf->getName());
$this->version = $version;
$this->prettyVersion = $prettyVersion;
$this->aliasOf = $aliasOf;
$this->dev = VersionParser::isDev($version);
// replace self.version dependencies
foreach (array('requires', 'recommends', 'suggests') as $type) {
$links = $aliasOf->{'get' . ucfirst($type)}();
foreach ($links as $index => $link) {
// link is self.version, but must be replacing also the replaced version
if ('self.version' === $link->getPrettyConstraint()) {
$links[$index] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $this->version);
}
}
$this->{$type} = $links;
}
// duplicate self.version provides
foreach (array('conflicts', 'provides', 'replaces') as $type) {
$links = $aliasOf->{'get' . ucfirst($type)}();
$newLinks = array();
foreach ($links as $link) {
// link is self.version, but must be replacing also the replaced version
if ('self.version' === $link->getPrettyConstraint()) {
$newLinks[] = new Link($link->getSource(), $link->getTarget(), new VersionConstraint('=', $this->version), $type, $this->version);
}
}
$this->{$type} = array_merge($links, $newLinks);
}
}
示例3: testIsDev
/**
* @dataProvider dataIsDev
*/
public function testIsDev($expected, $version)
{
$this->assertSame($expected, VersionParser::isDev($version));
}