فهرست منبع

Now using findPackage() instead of HasPackageName()

xy2z 5 سال پیش
والد
کامیت
1a0d5dfacd

+ 1 - 1
src/Composer/Command/InitCommand.php

@@ -795,7 +795,7 @@ EOT
         $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
 
         foreach ($results as $result) {
-            if ($installedRepo->hasPackageName($result['name'])) {
+            if ($installedRepo->findPackage($result['name'], '*')) {
                 // Ignore installed package
                 continue;
             }

+ 0 - 14
src/Composer/Repository/ArrayRepository.php

@@ -132,20 +132,6 @@ class ArrayRepository extends BaseRepository
         return false;
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public function hasPackageName(string $packageName)
-    {
-        foreach ($this->getPackages() as $repoPackage) {
-            if ($packageName === $repoPackage->getName()) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
     /**
      * Adds a new package to the repository
      *

+ 0 - 15
src/Composer/Repository/CompositeRepository.php

@@ -64,21 +64,6 @@ class CompositeRepository extends BaseRepository
         return false;
     }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function hasPackageName(string $packageName)
-    {
-        foreach ($this->repositories as $repository) {
-            /* @var $repository RepositoryInterface */
-            if ($repository->hasPackageName($packageName)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
     /**
      * {@inheritdoc}
      */

+ 0 - 9
src/Composer/Repository/RepositoryInterface.php

@@ -35,15 +35,6 @@ interface RepositoryInterface extends \Countable
      */
     public function hasPackage(PackageInterface $package);
 
-    /**
-     * Checks if specified package name is registered (installed).
-     *
-     * @param string $package_name package name (vendor/project)
-     *
-     * @return bool
-     */
-    public function hasPackageName(string $packageName);
-
     /**
      * Searches for the first match of a package by name and version.
      *