当前位置: 首页>>代码示例>>PHP>>正文


PHP PackageInterface::getDistType方法代码示例

本文整理汇总了PHP中Composer\Package\PackageInterface::getDistType方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageInterface::getDistType方法的具体用法?PHP PackageInterface::getDistType怎么用?PHP PackageInterface::getDistType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Composer\Package\PackageInterface的用法示例。


在下文中一共展示了PackageInterface::getDistType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: dump

 public function dump(PackageInterface $package)
 {
     $keys = array('binaries' => 'bin', 'type', 'extra', 'installationSource' => 'installation-source', 'autoload', 'notificationUrl' => 'notification-url', 'includePaths' => 'include-path');
     $data = array();
     $data['name'] = $package->getPrettyName();
     $data['version'] = $package->getPrettyVersion();
     $data['version_normalized'] = $package->getVersion();
     if ($package->getTargetDir()) {
         $data['target-dir'] = $package->getTargetDir();
     }
     if ($package->getSourceType()) {
         $data['source']['type'] = $package->getSourceType();
         $data['source']['url'] = $package->getSourceUrl();
         $data['source']['reference'] = $package->getSourceReference();
     }
     if ($package->getDistType()) {
         $data['dist']['type'] = $package->getDistType();
         $data['dist']['url'] = $package->getDistUrl();
         $data['dist']['reference'] = $package->getDistReference();
         $data['dist']['shasum'] = $package->getDistSha1Checksum();
     }
     if ($package->getArchiveExcludes()) {
         $data['archive']['exclude'] = $package->getArchiveExcludes();
     }
     foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
         if ($links = $package->{'get' . ucfirst($opts['method'])}()) {
             foreach ($links as $link) {
                 $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
             }
             ksort($data[$type]);
         }
     }
     if ($packages = $package->getSuggests()) {
         ksort($packages);
         $data['suggest'] = $packages;
     }
     if ($package->getReleaseDate()) {
         $data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
     }
     $data = $this->dumpValues($package, $keys, $data);
     if ($package instanceof CompletePackageInterface) {
         $keys = array('scripts', 'license', 'authors', 'description', 'homepage', 'keywords', 'repositories', 'support');
         $data = $this->dumpValues($package, $keys, $data);
         if (isset($data['keywords']) && is_array($data['keywords'])) {
             sort($data['keywords']);
         }
     }
     if ($package instanceof RootPackageInterface) {
         $minimumStability = $package->getMinimumStability();
         if ($minimumStability) {
             $data['minimum-stability'] = $minimumStability;
         }
     }
     return $data;
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:55,代码来源:ArrayDumper.php

示例2: dump

 public function dump(PackageInterface $package)
 {
     $keys = array('binaries' => 'bin', 'scripts', 'type', 'extra', 'installationSource' => 'installation-source', 'license', 'authors', 'description', 'homepage', 'keywords', 'autoload', 'repositories', 'includePaths' => 'include-path', 'support');
     $data = array();
     $data['name'] = $package->getPrettyName();
     $data['version'] = $package->getPrettyVersion();
     $data['version_normalized'] = $package->getVersion();
     if ($package->getTargetDir()) {
         $data['target-dir'] = $package->getTargetDir();
     }
     if ($package->getReleaseDate()) {
         $data['time'] = $package->getReleaseDate()->format('Y-m-d H:i:s');
     }
     if ($package->getSourceType()) {
         $data['source']['type'] = $package->getSourceType();
         $data['source']['url'] = $package->getSourceUrl();
         $data['source']['reference'] = $package->getSourceReference();
     }
     if ($package->getDistType()) {
         $data['dist']['type'] = $package->getDistType();
         $data['dist']['url'] = $package->getDistUrl();
         $data['dist']['reference'] = $package->getDistReference();
         $data['dist']['shasum'] = $package->getDistSha1Checksum();
     }
     foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
         if ($links = $package->{'get' . ucfirst($opts['method'])}()) {
             foreach ($links as $link) {
                 $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
             }
         }
     }
     if ($packages = $package->getSuggests()) {
         $data['suggest'] = $packages;
     }
     foreach ($keys as $method => $key) {
         if (is_numeric($method)) {
             $method = $key;
         }
         $getter = 'get' . ucfirst($method);
         $value = $package->{$getter}();
         if (null !== $value && !(is_array($value) && 0 === count($value))) {
             $data[$key] = $value;
         }
     }
     return $data;
 }
开发者ID:nicodmf,项目名称:composer,代码行数:46,代码来源:ArrayDumper.php

示例3: getPackageFilename

 /**
  * Generate a distinct filename for a particular version of a package.
  *
  * @param PackageInterface $package The package to get a name for
  *
  * @return string A filename without an extension
  */
 public function getPackageFilename(PackageInterface $package)
 {
     $nameParts = array(preg_replace('#[^a-z0-9-_.]#i', '-', $package->getName()));
     if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
         $nameParts = array_merge($nameParts, array($package->getDistReference(), $package->getDistType()));
     } else {
         $nameParts = array_merge($nameParts, array($package->getPrettyVersion(), $package->getDistReference()));
     }
     if ($package->getSourceReference()) {
         $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
     }
     return implode('-', array_filter($nameParts, function ($p) {
         return !empty($p);
     }));
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:22,代码来源:ArchiveManager.php

示例4: update

 /**
  * Updates package from initial to target version.
  *
  * @param PackageInterface $initial   initial package version
  * @param PackageInterface $target    target package version
  * @param string           $targetDir target dir
  *
  * @throws InvalidArgumentException if initial package is not installed
  */
 public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
 {
     $downloader = $this->getDownloaderForInstalledPackage($initial);
     $installationSource = $initial->getInstallationSource();
     if ('dist' === $installationSource) {
         $initialType = $initial->getDistType();
         $targetType = $target->getDistType();
     } else {
         $initialType = $initial->getSourceType();
         $targetType = $target->getSourceType();
     }
     // upgrading from a dist stable package to a dev package, force source reinstall
     if ($target->isDev() && 'dist' === $installationSource) {
         $downloader->remove($initial, $targetDir);
         $this->download($target, $targetDir);
         return;
     }
     if ($initialType === $targetType) {
         $target->setInstallationSource($installationSource);
         $downloader->update($initial, $target, $targetDir);
     } else {
         $downloader->remove($initial, $targetDir);
         $this->download($target, $targetDir, 'source' === $installationSource);
     }
 }
开发者ID:nicodmf,项目名称:composer,代码行数:34,代码来源:DownloadManager.php

示例5: getCacheKey

 private function getCacheKey(PackageInterface $package)
 {
     if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
         return $package->getName() . '/' . $package->getDistReference() . '.' . $package->getDistType();
     }
     return $package->getName() . '/' . $package->getVersion() . '-' . $package->getDistReference() . '.' . $package->getDistType();
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:7,代码来源:FileDownloader.php

示例6: updateInformation

 private function updateInformation(Package $package, PackageInterface $data, $flags)
 {
     $em = $this->doctrine->getManager();
     $version = new Version();
     $normVersion = $data->getVersion();
     $existingVersion = $package->getVersion($normVersion);
     if ($existingVersion) {
         $source = $existingVersion->getSource();
         // update if the right flag is set, or the source reference has changed (re-tag or new commit on branch)
         if ($source['reference'] !== $data->getSourceReference() || $flags & self::UPDATE_EQUAL_REFS) {
             $version = $existingVersion;
         } else {
             // mark it updated to avoid it being pruned
             $existingVersion->setUpdatedAt(new \DateTime());
             return false;
         }
     }
     $version->setName($package->getName());
     $version->setVersion($data->getPrettyVersion());
     $version->setNormalizedVersion($normVersion);
     $version->setDevelopment($data->isDev());
     $em->persist($version);
     $descr = $this->sanitize($data->getDescription());
     $version->setDescription($descr);
     $package->setDescription($descr);
     $version->setHomepage($data->getHomepage());
     $version->setLicense($data->getLicense() ?: array());
     $version->setPackage($package);
     $version->setUpdatedAt(new \DateTime());
     $version->setReleasedAt($data->getReleaseDate());
     if ($data->getSourceType()) {
         $source['type'] = $data->getSourceType();
         $source['url'] = $data->getSourceUrl();
         $source['reference'] = $data->getSourceReference();
         $version->setSource($source);
     } else {
         $version->setSource(null);
     }
     if ($data->getDistType()) {
         $dist['type'] = $data->getDistType();
         $dist['url'] = $data->getDistUrl();
         $dist['reference'] = $data->getDistReference();
         $dist['shasum'] = $data->getDistSha1Checksum();
         $version->setDist($dist);
     } else {
         $version->setDist(null);
     }
     if ($data->getType()) {
         $type = $this->sanitize($data->getType());
         $version->setType($type);
         if ($type !== $package->getType()) {
             $package->setType($type);
         }
     }
     $version->setTargetDir($data->getTargetDir());
     $version->setAutoload($data->getAutoload());
     $version->setExtra($data->getExtra());
     $version->setBinaries($data->getBinaries());
     $version->setIncludePaths($data->getIncludePaths());
     $version->setSupport($data->getSupport());
     if ($data->getKeywords()) {
         $keywords = array();
         foreach ($data->getKeywords() as $keyword) {
             $keywords[mb_strtolower($keyword, 'UTF-8')] = $keyword;
         }
         $existingTags = [];
         foreach ($version->getTags() as $tag) {
             $existingTags[mb_strtolower($tag->getName(), 'UTF-8')] = $tag;
         }
         foreach ($keywords as $tagKey => $keyword) {
             if (isset($existingTags[$tagKey])) {
                 unset($existingTags[$tagKey]);
                 continue;
             }
             $tag = Tag::getByName($em, $keyword, true);
             if (!$version->getTags()->contains($tag)) {
                 $version->addTag($tag);
             }
         }
         foreach ($existingTags as $tag) {
             $version->getTags()->removeElement($tag);
         }
     } elseif (count($version->getTags())) {
         $version->getTags()->clear();
     }
     $authorRepository = $this->doctrine->getRepository('PackagistWebBundle:Author');
     $version->getAuthors()->clear();
     if ($data->getAuthors()) {
         foreach ($data->getAuthors() as $authorData) {
             $author = null;
             foreach (array('email', 'name', 'homepage', 'role') as $field) {
                 if (isset($authorData[$field])) {
                     $authorData[$field] = trim($authorData[$field]);
                     if ('' === $authorData[$field]) {
                         $authorData[$field] = null;
                     }
                 } else {
                     $authorData[$field] = null;
                 }
             }
//.........这里部分代码省略.........
开发者ID:jakoch,项目名称:packagist,代码行数:101,代码来源:Updater.php

示例7: getDistType

 /**
  * {@inheritdoc}
  */
 public function getDistType()
 {
     return $this->package->getDistType();
 }
开发者ID:tenside,项目名称:core,代码行数:7,代码来源:VersionedPackage.php

示例8: getCacheKey

 private function getCacheKey(PackageInterface $package, $processedUrl)
 {
     // we use the complete download url here to avoid conflicting entries
     // from different packages, which would potentially allow a given package
     // in a third party repo to pre-populate the cache for the same package in
     // packagist for example.
     $cacheKey = sha1($processedUrl);
     return $package->getName() . '/' . $cacheKey . '.' . $package->getDistType();
 }
开发者ID:alcaeus,项目名称:composer,代码行数:9,代码来源:FileDownloader.php

示例9: updateInformation

 private function updateInformation(Package $package, PackageInterface $data, $flags)
 {
     $em = $this->doctrine->getEntityManager();
     $version = new Version();
     $version->setNormalizedVersion($data->getVersion());
     // check if we have that version yet
     foreach ($package->getVersions() as $existingVersion) {
         if ($existingVersion->getNormalizedVersion() === $version->getNormalizedVersion()) {
             if ($existingVersion->getDevelopment() || $flags & self::UPDATE_TAGS) {
                 $version = $existingVersion;
                 break;
             }
             // mark it updated to avoid it being pruned
             $existingVersion->setUpdatedAt(new \DateTime());
             return;
         }
     }
     $version->setName($package->getName());
     $version->setVersion($data->getPrettyVersion());
     $version->setDevelopment($data->isDev());
     $em->persist($version);
     $version->setDescription($data->getDescription());
     $package->setDescription($data->getDescription());
     $version->setHomepage($data->getHomepage());
     $version->setLicense($data->getLicense() ?: array());
     $version->setPackage($package);
     $version->setUpdatedAt(new \DateTime());
     $version->setReleasedAt($data->getReleaseDate());
     if ($data->getSourceType()) {
         $source['type'] = $data->getSourceType();
         $source['url'] = $data->getSourceUrl();
         $source['reference'] = $data->getSourceReference();
         $version->setSource($source);
     }
     if ($data->getDistType()) {
         $dist['type'] = $data->getDistType();
         $dist['url'] = $data->getDistUrl();
         $dist['reference'] = $data->getDistReference();
         $dist['shasum'] = $data->getDistSha1Checksum();
         $version->setDist($dist);
     }
     if ($data->getType()) {
         $version->setType($data->getType());
         if ($data->getType() && $data->getType() !== $package->getType()) {
             $package->setType($data->getType());
         }
     }
     $version->setTargetDir($data->getTargetDir());
     $version->setAutoload($data->getAutoload());
     $version->setExtra($data->getExtra());
     $version->setBinaries($data->getBinaries());
     $version->setIncludePaths($data->getIncludePaths());
     $version->setSupport($data->getSupport());
     $version->getTags()->clear();
     if ($data->getKeywords()) {
         foreach ($data->getKeywords() as $keyword) {
             $tag = Tag::getByName($em, $keyword, true);
             if (!$version->getTags()->contains($tag)) {
                 $version->addTag($tag);
             }
         }
     }
     $authorRepository = $this->doctrine->getRepository('PackagistWebBundle:Author');
     $version->getAuthors()->clear();
     if ($data->getAuthors()) {
         foreach ($data->getAuthors() as $authorData) {
             $author = null;
             // skip authors with no information
             if (empty($authorData['email']) && empty($authorData['name'])) {
                 continue;
             }
             if (!empty($authorData['email'])) {
                 $author = $authorRepository->findOneByEmail($authorData['email']);
             }
             if (!$author && !empty($authorData['homepage'])) {
                 $author = $authorRepository->findOneBy(array('name' => $authorData['name'], 'homepage' => $authorData['homepage']));
             }
             if (!$author && !empty($authorData['name'])) {
                 $author = $authorRepository->findOneByNameAndPackage($authorData['name'], $package);
             }
             if (!$author) {
                 $author = new Author();
                 $em->persist($author);
             }
             foreach (array('email', 'name', 'homepage', 'role') as $field) {
                 if (isset($authorData[$field])) {
                     $author->{'set' . $field}($authorData[$field]);
                 }
             }
             $author->setUpdatedAt(new \DateTime());
             if (!$version->getAuthors()->contains($author)) {
                 $version->addAuthor($author);
             }
             if (!$author->getVersions()->contains($version)) {
                 $author->addVersion($version);
             }
         }
     }
     // handle links
     foreach ($this->supportedLinkTypes as $linkType => $opts) {
//.........这里部分代码省略.........
开发者ID:ronnylt,项目名称:packagist,代码行数:101,代码来源:Updater.php

示例10: getCacheKey

 public static function getCacheKey(Package\PackageInterface $p)
 {
     $distRef = $p->getDistReference();
     if (preg_match('{^[a-f0-9]{40}$}', $distRef)) {
         return "{$p->getName()}/{$distRef}.{$p->getDistType()}";
     }
     return "{$p->getName()}/{$p->getVersion()}-{$distRef}.{$p->getDistType()}";
 }
开发者ID:nilopc-interesting-libs,项目名称:prestissimo,代码行数:8,代码来源:ParallelDownloader.php

示例11: createZipFile

 /**
  * @param string $cacheDir
  * @param string $targetDir
  * @param \Composer\Package\PackageInterface $package
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  * @param \Composer\Util\ProcessExecutor $process
  * @return string
  * @throws \Exception
  */
 protected function createZipFile($cacheDir, $targetDir, \Composer\Package\PackageInterface $package, OutputInterface $output, \Composer\Util\ProcessExecutor $process)
 {
     $zipfileName = str_replace('/', '_', strtolower($package->getPrettyName()));
     if ($package->getDistType() === 'pear') {
         $rootPath = $cacheDir;
         $zipPath = escapeshellarg($package->getPrettyName());
     } else {
         if ($package->getTargetDir()) {
             $rootPath = $cacheDir . '/' . $package->getPrettyName() . '/' . $package->getTargetDir();
             $zipPath = '.';
         } else {
             $rootPath = $cacheDir . '/' . $package->getPrettyName();
             $zipPath = '.';
         }
     }
     $output->writeln('  - ' . $zipfileName . '.zip');
     if (!class_exists('ZipArchive')) {
         $command = 'cd ' . escapeshellarg($rootPath) . ' && zip -9 -r ' . escapeshellarg($targetDir . '/dists/' . $zipfileName . '.zip') . ' ' . $zipPath;
         $result = $process->execute($command);
         if ($result) {
             throw new \Exception('could not create dist package for ' . $package->getName());
         }
     } else {
         $zipFile = $targetDir . '/dists/' . $zipfileName . '.zip';
         $zipArchive = new ZipArchive();
         $zipArchive->addExcludeDirectory('.svn');
         $zipArchive->setArchiveBaseDir($rootPath);
         if (($result = $zipArchive->open($zipFile, ZipArchive::OVERWRITE)) === TRUE) {
             $zipArchive->addDir($rootPath);
             $zipArchive->close();
         } else {
             throw new \Exception('could not create dist package for ' . $package->getName() . ' error code: ' . $result);
         }
     }
     return $zipfileName;
 }
开发者ID:researchgate,项目名称:broker,代码行数:45,代码来源:AddRepository.php

示例12: updateInformation

 private function updateInformation(OutputInterface $output, RegistryInterface $doctrine, $package, PackageInterface $data)
 {
     $em = $doctrine->getEntityManager();
     $version = new Version();
     $version->setName($package->getName());
     $version->setNormalizedVersion(preg_replace('{-dev$}i', '', $data->getVersion()));
     // check if we have that version yet
     foreach ($package->getVersions() as $existingVersion) {
         if ($existingVersion->equals($version)) {
             // avoid updating newer versions, in case two branches have the same version in their composer.json
             if ($existingVersion->getReleasedAt() > $data->getReleaseDate()) {
                 return;
             }
             if ($existingVersion->getDevelopment()) {
                 $version = $existingVersion;
                 break;
             }
             return;
         }
     }
     $version->setVersion($data->getPrettyVersion());
     $version->setDevelopment(substr($data->getVersion(), -4) === '-dev');
     $em->persist($version);
     $version->setDescription($data->getDescription());
     $package->setDescription($data->getDescription());
     $version->setHomepage($data->getHomepage());
     $version->setLicense($data->getLicense() ?: array());
     $version->setPackage($package);
     $version->setUpdatedAt(new \DateTime());
     $version->setReleasedAt($data->getReleaseDate());
     if ($data->getSourceType()) {
         $source['type'] = $data->getSourceType();
         $source['url'] = $data->getSourceUrl();
         $source['reference'] = $data->getSourceReference();
         $version->setSource($source);
     }
     if ($data->getDistType()) {
         $dist['type'] = $data->getDistType();
         $dist['url'] = $data->getDistUrl();
         $dist['reference'] = $data->getDistReference();
         $dist['shasum'] = $data->getDistSha1Checksum();
         $version->setDist($dist);
     }
     if ($data->getType()) {
         $version->setType($data->getType());
         if ($data->getType() && $data->getType() !== $package->getType()) {
             $package->setType($data->getType());
         }
     }
     $version->setTargetDir($data->getTargetDir());
     $version->setAutoload($data->getAutoload());
     $version->setExtra($data->getExtra());
     $version->setBinaries($data->getBinaries());
     $version->getTags()->clear();
     if ($data->getKeywords()) {
         foreach ($data->getKeywords() as $keyword) {
             $version->addTag(Tag::getByName($em, $keyword, true));
         }
     }
     $version->getAuthors()->clear();
     if ($data->getAuthors()) {
         foreach ($data->getAuthors() as $authorData) {
             $author = null;
             // skip authors with no information
             if (empty($authorData['email']) && empty($authorData['name'])) {
                 continue;
             }
             if (!empty($authorData['email'])) {
                 $author = $doctrine->getRepository('PackagistWebBundle:Author')->findOneByEmail($authorData['email']);
             }
             if (!$author && !empty($authorData['homepage'])) {
                 $author = $doctrine->getRepository('PackagistWebBundle:Author')->findOneBy(array('name' => $authorData['name'], 'homepage' => $authorData['homepage']));
             }
             if (!$author && !empty($authorData['name'])) {
                 $author = $doctrine->getRepository('PackagistWebBundle:Author')->findOneByNameAndPackage($authorData['name'], $package);
             }
             if (!$author) {
                 $author = new Author();
                 $em->persist($author);
             }
             foreach (array('email', 'name', 'homepage') as $field) {
                 if (isset($authorData[$field])) {
                     $author->{'set' . $field}($authorData[$field]);
                 }
             }
             $author->setUpdatedAt(new \DateTime());
             if (!$version->getAuthors()->contains($author)) {
                 $version->addAuthor($author);
             }
             if (!$author->getVersions()->contains($version)) {
                 $author->addVersion($version);
             }
         }
     }
     foreach ($this->supportedLinkTypes as $linkType => $linkEntity) {
         $links = array();
         foreach ($data->{'get' . $linkType . 's'}() as $link) {
             $links[$link->getTarget()] = $link->getPrettyConstraint();
         }
         foreach ($version->{'get' . $linkType}() as $link) {
//.........这里部分代码省略.........
开发者ID:nesQuick,项目名称:packagist,代码行数:101,代码来源:UpdatePackagesCommand.php

示例13: getDistType

 public function getDistType()
 {
     return $this->aliasOf->getDistType();
 }
开发者ID:neon64,项目名称:composer,代码行数:4,代码来源:AliasPackage.php

示例14: update

 /**
  * Updates package from initial to target version.
  *
  * @param PackageInterface $initial   initial package version
  * @param PackageInterface $target    target package version
  * @param string           $targetDir target dir
  *
  * @throws \InvalidArgumentException if initial package is not installed
  */
 public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
 {
     $downloader = $this->getDownloaderForInstalledPackage($initial);
     if (!$downloader) {
         return;
     }
     $installationSource = $initial->getInstallationSource();
     if ('dist' === $installationSource) {
         $initialType = $initial->getDistType();
         $targetType = $target->getDistType();
     } else {
         $initialType = $initial->getSourceType();
         $targetType = $target->getSourceType();
     }
     // upgrading from a dist stable package to a dev package, force source reinstall
     if ($target->isDev() && 'dist' === $installationSource) {
         $downloader->remove($initial, $targetDir);
         $this->download($target, $targetDir);
         return;
     }
     if ($initialType === $targetType) {
         $target->setInstallationSource($installationSource);
         try {
             $downloader->update($initial, $target, $targetDir);
             return;
         } catch (\RuntimeException $e) {
             if (!$this->io->isInteractive()) {
                 throw $e;
             }
             $this->io->writeError('<error>    Update failed (' . $e->getMessage() . ')</error>');
             if (!$this->io->askConfirmation('    Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
                 throw $e;
             }
         }
     }
     $downloader->remove($initial, $targetDir);
     $this->download($target, $targetDir, 'source' === $installationSource);
 }
开发者ID:alcaeus,项目名称:composer,代码行数:47,代码来源:DownloadManager.php

示例15: update

 /**
  * Updates package from initial to target version.
  *
  * @param   PackageInterface    $initial    initial package version
  * @param   PackageInterface    $target     target package version
  * @param   string              $targetDir  target dir
  *
  * @throws  InvalidArgumentException        if initial package is not installed
  */
 public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
 {
     $downloader = $this->getDownloaderForInstalledPackage($initial);
     $installationSource = $initial->getInstallationSource();
     if ('dist' === $installationSource) {
         $initialType = $initial->getDistType();
         $targetType = $target->getDistType();
     } else {
         $initialType = $initial->getSourceType();
         $targetType = $target->getSourceType();
     }
     if ($initialType === $targetType) {
         $target->setInstallationSource($installationSource);
         $downloader->update($initial, $target, $targetDir);
     } else {
         $downloader->remove($initial, $targetDir);
         $this->download($target, $targetDir, 'source' === $installationSource);
     }
 }
开发者ID:natxet,项目名称:composer,代码行数:28,代码来源:DownloadManager.php


注:本文中的Composer\Package\PackageInterface::getDistType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。