當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Package::setType方法代碼示例

本文整理匯總了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;
 }
開發者ID:frogriotcom,項目名稱:CheckBundles,代碼行數:13,代碼來源:ComposerHelperTest.php

示例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);
 }
開發者ID:lappuse,項目名稱:composer-installer,代碼行數:13,代碼來源:ThemeInstallerTest.php

示例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);
 }
開發者ID:alex-krav,項目名稱:personal-page-codeigniter,代碼行數:13,代碼來源:CodeigniterInstallerTest.php

示例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);
 }
開發者ID:frogriotcom,項目名稱:CheckBundles,代碼行數:13,代碼來源:ComposerTestCase.php

示例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);
 }
開發者ID:neyensp,項目名稱:custom-installer,代碼行數:21,代碼來源:CustomInstallerTest.php

示例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;
 }
開發者ID:composer,項目名稱:satis,代碼行數:19,代碼來源:ArchiveBuilderHelperTest.php

示例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;
 }
開發者ID:ausger,項目名稱:satis,代碼行數:19,代碼來源:ArchiveBuilderHelperTest.php

示例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);
         }
     }
 }
開發者ID:sidisinsane,項目名稱:fiddler,代碼行數:22,代碼來源:Build.php

示例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);
 }
開發者ID:monofone,項目名稱:ansible-installer,代碼行數:14,代碼來源:InstallerTest.php

示例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));
 }
開發者ID:adam-paterson,項目名稱:magento-connect-composer-plugin,代碼行數:17,代碼來源:Plugin.php

示例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;
 }
開發者ID:fuzzyma,項目名稱:composer-register-bundle-plugin,代碼行數:7,代碼來源:RegisterCommandTest.php

示例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));
 }
開發者ID:AydinHassan,項目名稱:magento-connect-composer-plugin,代碼行數:28,代碼來源:Plugin.php

示例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;
 }
開發者ID:REZ1DENT3,項目名稱:mystem,代碼行數:23,代碼來源:MystemBinaryInstaller.php

示例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);
 }
開發者ID:fancyguy,項目名稱:webroot-installer,代碼行數:21,代碼來源:WebrootInstallerTest.php

示例15: createCorePackage

 public function createCorePackage($name = 'magento/core-package')
 {
     $package = new Package($name, "1.0.0", $name);
     $package->setType('magento-core');
     return $package;
 }
開發者ID:robofirm,項目名稱:magento-core-composer-installer,代碼行數:6,代碼來源:CoreManagerTest.php


注:本文中的Composer\Package\Package::setType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。