本文整理汇总了PHP中Composer\Package\Package::setType方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::setType方法的具体用法?PHP Package::setType怎么用?PHP Package::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Composer\Package\Package
的用法示例。
在下文中一共展示了Package::setType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createPackage
/**
* @param string $type
* @param string $targetDir
* @param array $autoload
* @return \Composer\Package\Package
*/
protected function createPackage($name, $type, array $autoload)
{
$package = new Package($name, 'dev-master', '9999999-dev');
$package->setType($type);
$package->setAutoload($autoload);
return $package;
}
示例2: testGetPackageBasePath
/**
* testGetPackageBasePath
*
* @dataProvider dataForTestInstallPath
*/
public function testGetPackageBasePath($type, $path, $name, $version = '1.0.0')
{
$installer = new ThemeInstaller($this->io, $this->composer, $type);
$package = new Package($name, $version, $version);
$package->setType($type);
$result = $installer->getPackageBasePath($package);
$this->assertEquals($path, $result);
}
示例3: testInstallPath
/**
* testInstallPath
*
* @dataProvider dataForTestInstallPath
*/
public function testInstallPath($type, $path, $name)
{
$installer = new CodeigniterInstaller($this->io, $this->composer);
$package = new Package($name, '1.0.0', '1.0.0');
$package->setType($type);
$result = $installer->getInstallPath($package);
$this->assertEquals($path, $result);
}
示例4: getInstalledPackages
public function getInstalledPackages()
{
$fooPackage = new Package('acme/foo-bundle', 'dev-master', '9999999-dev');
$fooPackage->setAutoload(array('psr-0' => array('Acme\\FooBundle' => '')));
$fooPackage->setType('symfony-bundle');
$barPackage = new Package('acme/bar-bundle', 'dev-master', '9999999-dev');
$barPackage->setAutoload(array('psr-0' => array('Acme\\BarBundle' => 'src/')));
$barPackage->setType('symfony-bundle');
$fooBarPackage = new Package('acme/foobar-bundle', 'dev-master', '9999999-dev');
$fooBarPackage->setAutoload(array('psr-4' => array('Acme\\FooBarBundle\\' => '')));
$fooBarPackage->setType('symfony-bundle');
return array($fooPackage, $barPackage, $fooBarPackage);
}
示例5: testInstallPath
/**
* testInstallPath
*
* @dataProvider dataForInstallPath
*/
public function testInstallPath($name, $type, $path, $expected)
{
$composer = new Composer();
$config = new Config();
$composer->setConfig($config);
$repository = $this->getMock('Composer\\Repository\\InstalledRepositoryInterface');
$io = $this->getMock('Composer\\IO\\IOInterface');
$installer = new CustomInstaller($io, $composer);
$package = new Package($name, '1.0.0', '1.0.0');
$package->setType($type);
$consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
$composer->setPackage($consumerPackage);
$consumerPackage->setExtra(array('custom-installer' => array($type => $path)));
$result = $installer->getInstallPath($package);
$this->assertEquals($expected, $result);
}
示例6: dataPackages
public function dataPackages()
{
$metapackage = new Package('vendor/name', '1.0.0.0', '1.0');
$metapackage->setType('metapackage');
$package1 = new Package('vendor/name', '1.0.0.0', '1.0');
$package2 = new Package('vendor/name', 'dev-master', 'dev-master');
$package3 = new Package('othervendor/othername', '1.0.0.0', '1.0');
$package3->setProvides([new Link('', 'vendor/name')]);
$data = [];
$data['metapackage'] = [true, $metapackage, []];
$data['skipDev is true, but package is not'] = [false, $package1, ['skip-dev' => 1]];
$data['skipDev is true, package isDev'] = [true, $package2, ['skip-dev' => 1]];
$data['package in whitelist'] = [false, $package1, ['whitelist' => ['vendor/name']]];
$data['package not in whitelist'] = [true, $package1, ['whitelist' => ['othervendor/othername']]];
$data['package in blacklist'] = [true, $package1, ['blacklist' => ['vendor/name']]];
$data['package not in blacklist'] = [false, $package1, ['blacklist' => ['othervendor/othername']]];
$data['package provides a virtual package in blacklist'] = [true, $package3, ['blacklist' => ['vendor/name']]];
return $data;
}
示例7: dataPackages
public function dataPackages()
{
$metapackage = new Package('vendor/name', '1.0.0.0', '1.0');
$metapackage->setType('metapackage');
$package1 = new Package('vendor/name', '1.0.0.0', '1.0');
$package2 = new Package('vendor/name', 'dev-master', 'dev-master');
$package3 = new Package('othervendor/othername', '1.0.0.0', '1.0');
$package3->setProvides(array(new Link('', 'vendor/name')));
$data = array();
$data['metapackage'] = array(true, $metapackage, array());
$data['skipDev is true, but package is not'] = array(false, $package1, array('skip-dev' => 1));
$data['skipDev is true, package isDev'] = array(true, $package2, array('skip-dev' => 1));
$data['package in whitelist'] = array(false, $package1, array('whitelist' => array('vendor/name')));
$data['package not in whitelist'] = array(true, $package1, array('whitelist' => array('othervendor/othername')));
$data['package in blacklist'] = array(true, $package1, array('blacklist' => array('vendor/name')));
$data['package not in blacklist'] = array(false, $package1, array('blacklist' => array('othervendor/othername')));
$data['package provides a virtual package in blacklist'] = array(true, $package3, array('blacklist' => array('vendor/name')));
return $data;
}
示例8: resolvePackageDependencies
private function resolvePackageDependencies($repository, $packages, $packageName)
{
$config = $packages[$packageName];
foreach ($config['deps'] as $dependencyName) {
if ($dependencyName === 'vendor/php' || strpos($dependencyName, 'vendor/ext-') === 0 || strpos($dependencyName, 'vendor/lib-') === 0) {
continue;
}
if (!isset($packages[$dependencyName])) {
throw new \RuntimeException("Requiring non existant package '" . $dependencyName . "' in '" . $packageName . "'.");
}
$dependency = $packages[$dependencyName];
$package = new Package($dependency['path'], "@stable", "@stable");
$package->setType('fiddler');
if (isset($dependency['autoload']) && is_array($dependency['autoload'])) {
$package->setAutoload($dependency['autoload']);
}
if (!$repository->hasPackage($package)) {
$repository->addPackage($package);
$this->resolvePackageDependencies($repository, $packages, $dependencyName);
}
}
}
示例9: testGetCakePHPInstallPathException
/**
* testGetCakePHPInstallPathException
*
* @return void
*
* @expectedException \InvalidArgumentException
*/
public function testGetCakePHPInstallPathException()
{
$installer = new Installer($this->io, $this->composer);
$package = new Package('shama/ftp', '1.0.0', '1.0.0');
$package->setType('cakephp-whoops');
$result = $installer->getInstallPath($package);
}
示例10: addPackages
/**
* @param array $releases
* @param string $connectPackage
* @return RepositoryInterface
*/
private function addPackages(array $releases, $connectPackage)
{
return new ArrayRepository(array_map(function ($release) use($connectPackage) {
$distUrl = sprintf($this->distUrlFormat, $connectPackage, $release, $connectPackage, $release);
$package = new Package(strtolower($connectPackage), $release, $release);
$package->setDistUrl($distUrl);
$package->setDistType('tar');
$package->setType('magento-module');
$package->setExtra(['package-xml' => "package.xml"]);
return $package;
}, $releases));
}
示例11: createPackage
public function createPackage($name, $ns, $type = 'symfony-bundle')
{
$package = new Package($name, '1.0.0', '1.0.0');
$package->setType($type);
$package->setAutoload(['psr-4' => [$ns => '']]);
return $package;
}
示例12: addPackages
/**
* @param array $releases
* @param string $connectPackage
* @param VersionParser $versionParser
* @return RepositoryInterface
*/
private function addPackages(array $releases, $connectPackage, VersionParser $versionParser)
{
$releases = array_filter($releases, function ($release) use($versionParser) {
try {
$versionParser->normalize($release);
} catch (UnexpectedValueException $e) {
$this->writeVerbose(sprintf('Version "%s" is not valid. Skipping this version.', $release));
return false;
}
return true;
});
return new ArrayRepository(array_map(function ($release) use($connectPackage, $versionParser) {
$distUrl = sprintf($this->distUrlFormat, $connectPackage, $release, $connectPackage, $release);
$release = $versionParser->normalize($release);
$package = new Package(strtolower($connectPackage), $release, $release);
$package->setDistUrl($distUrl);
$package->setDistType('tar');
$package->setType('magento-module');
$package->setExtra(['package-xml' => "package.xml"]);
return $package;
}, $releases));
}
示例13: bindPackageValues
/**
* @param string $newName
* @param array $package
* @return Package
*/
protected static function bindPackageValues($newName, array $package)
{
$new = new Package($newName, $package['version'], $package['version']);
$new->setType('dist');
if (isset($package['bin'])) {
$new->setBinaries($package['bin']);
}
if (isset($package['dist']['type'])) {
$new->setDistType($package['dist']['type']);
}
if (isset($package['dist']['url'])) {
$new->setDistUrl($package['dist']['url']);
}
if (isset($package['excludes'])) {
$new->setArchiveExcludes($package['excludes']);
}
return $new;
}
示例14: testGetMultipleWebrootPackagesException
/**
* testGetMultipleWebrootPackagesException
*
* @return void
*
* @expectedException \InvalidArgumentException
*/
public function testGetMultipleWebrootPackagesException()
{
$installer = new WebrootInstaller($this->io, $this->composer);
$package1 = new Package('fancyguy/webroot-package', '1.0.0', '1.0.0');
$package1->setType('webroot');
$package2 = new Package('fancyguy/another-webroot-package', '1.0.0', '1.0.0');
$package2->setType('webroot');
$consumerPackage = new RootPackage('foo/bar', '1.0.0', '1.0.0');
$this->composer->setPackage($consumerPackage);
$consumerPackage->setExtra(array('webroot-dir' => 'content', 'webroot-package' => 'fancyguy/webroot-package'));
$consumerPackage->setRequires(array($package1, $package2));
$result1 = $installer->getInstallPath($package1);
$result2 = $installer->getInstallPath($package2);
}
示例15: createCorePackage
public function createCorePackage($name = 'magento/core-package')
{
$package = new Package($name, "1.0.0", $name);
$package->setType('magento-core');
return $package;
}