update PluginController to use PHPCI plugin directory as well as composer to get information about installed plugins.
This commit is contained in:
parent
28fc30682b
commit
aa33a8761e
3 changed files with 60 additions and 4 deletions
48
PHPCI/Plugin/Util/PluginInformationCollection.php
Normal file
48
PHPCI/Plugin/Util/PluginInformationCollection.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace PHPCI\Plugin\Util;
|
||||
|
||||
class PluginInformationCollection implements InstalledPluginInformation
|
||||
{
|
||||
/**
|
||||
* @var InstalledPluginInformation[]
|
||||
*/
|
||||
protected $pluginInformations = array();
|
||||
|
||||
public function add(InstalledPluginInformation $information)
|
||||
{
|
||||
$this->pluginInformations[] = $information;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of objects. Each one represents an available plugin
|
||||
* and will have the following properties:
|
||||
* name - The friendly name of the plugin (may be an empty string)
|
||||
* class - The class of the plugin (will include namespace)
|
||||
* @return \stdClass[]
|
||||
*/
|
||||
public function getInstalledPlugins()
|
||||
{
|
||||
$arr = array();
|
||||
foreach($this->pluginInformations as $single) {
|
||||
$arr = array_merge($arr, $single->getInstalledPlugins());
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all the class names of plugins that have been
|
||||
* loaded.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getPluginClasses()
|
||||
{
|
||||
$arr = array();
|
||||
foreach($this->pluginInformations as $single) {
|
||||
$arr = array_merge($arr, $single->getPluginClasses());
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue