Browse Source

Plugins receive composer and io objects on construction already

Nils Adermann 12 years ago
parent
commit
9402a9fb3c

+ 2 - 4
src/Composer/Plugin/PluginInterface.php

@@ -22,9 +22,7 @@ use Composer\Composer;
 interface PluginInterface
 interface PluginInterface
 {
 {
     /**
     /**
-     * Apply plugin modifications to the passed in composer object
-     *
-     * @param Composer $composer
+     * Apply plugin modifications to composer
      */
      */
-    public function activate(Composer $composer);
+    public function activate();
 }
 }

+ 2 - 2
src/Composer/Plugin/PluginManager.php

@@ -64,7 +64,7 @@ class PluginManager
     public function addPlugin(PluginInterface $plugin)
     public function addPlugin(PluginInterface $plugin)
     {
     {
         $this->plugins[] =  $plugin;
         $this->plugins[] =  $plugin;
-        $plugin->activate($this->composer);
+        $plugin->activate();
 
 
         if ($plugin instanceof EventSubscriberInterface) {
         if ($plugin instanceof EventSubscriberInterface) {
             $this->composer->getEventDispatcher()->addSubscriber($plugin);
             $this->composer->getEventDispatcher()->addSubscriber($plugin);
@@ -102,7 +102,7 @@ class PluginManager
                 self::$classCounter++;
                 self::$classCounter++;
             }
             }
 
 
-            $plugin = new $class($this->io, $this->composer);
+            $plugin = new $class($this->composer, $this->io);
 
 
             if ($oldInstallerPlugin) {
             if ($oldInstallerPlugin) {
                 $this->composer->getInstallationManager()->addInstaller($installer);
                 $this->composer->getInstallationManager()->addInstaller($installer);

+ 10 - 0
src/Composer/Util/RemoteFilesystem.php

@@ -76,6 +76,16 @@ class RemoteFilesystem
         return $this->get($originUrl, $fileUrl, $options, null, $progress);
         return $this->get($originUrl, $fileUrl, $options, null, $progress);
     }
     }
 
 
+    /**
+     * Retrieve the options set in the constructor
+     *
+     * @return array Options
+     */
+    public function getOptions()
+    {
+        return $this->options;
+    }
+
     /**
     /**
      * Get file content or copy action.
      * Get file content or copy action.
      *
      *