mirror of
https://github.com/composer/composer
synced 2025-05-11 09:32:55 +00:00
Implement a plugin manager and interface, update installer plugin tests
This commit is contained in:
parent
01a08a2ff3
commit
eb966d347f
23 changed files with 238 additions and 156 deletions
49
src/Composer/Plugin/PluginManager.php
Normal file
49
src/Composer/Plugin/PluginManager.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Plugin;
|
||||
|
||||
use Composer\Composer;
|
||||
use Composer\Package\PackageInterface;
|
||||
|
||||
/**
|
||||
* Plugin manager
|
||||
*
|
||||
* @author Nils Adermann <naderman@naderman.de>
|
||||
*/
|
||||
class PluginManager
|
||||
{
|
||||
protected $composer;
|
||||
|
||||
protected $plugins = array();
|
||||
|
||||
/**
|
||||
* Initializes plugin manager
|
||||
*
|
||||
* @param Composer $composer
|
||||
*/
|
||||
public function __construct(Composer $composer)
|
||||
{
|
||||
$this->composer = $composer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds plugin
|
||||
*
|
||||
* @param PluginInterface $plugin plugin instance
|
||||
*/
|
||||
public function addPlugin(PluginInterface $plugin)
|
||||
{
|
||||
$this->plugins[] = $plugin;
|
||||
$plugin->activate($this->composer);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue