composer / installers

A Multi-Framework Composer Library Installer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow string values in installer paths

codymorgan opened this issue · comments

Due to Composer's current inability to add array values to "extra" or any of it's children from the cli
(composer/composer#5759) i'm wondering if it would be feasible to allow for string values to be handled by the BaseInstaller

while maybe a bit sloppy, the following approach could maybe work:

if the value is a string it is simply made into a single item array allowing the rest of the process to behave as normal.

example:

  protected function mapCustomInstallPaths(array $paths, $name, $type, $vendor = NULL)
   {
       foreach ($paths as $path => $names) {
           if (is_string($names)) {
               $names = array($names);
           }
           if (in_array($name, $names) || in_array('type:' . $type, $names) || in_array('vendor:' . $vendor, $names)) {
               return $path;
           }
       }

       return false;
   }

sorry this duped #449