public function getPlugins()
{
if (!$this->_plugins) {
$manifest = $this->_plugin_path . '/composer.json';
if (!file_exists($manifest)) {
return array();
}
$contents = file_get_contents($manifest);
if ($contents === false) {
return array();
}
$data = json_decode($contents);
if (!isset($data->require)) {
return array();
}
$this->_plugins = array();
foreach ($data->require as $package => $version) {
$file = $this->_plugin_path . '/vendor/' . $package . '/composer.json';
if (file_exists($file)) {
$json = file_get_contents($file);
$manifest = json_decode($json);
if (is_null($manifest)) {
continue;
}
if (isset($manifest->type) && $manifest->type == 'joomlatools-console-plugin') {
$this->_plugins[$package] = $version;
}
}
}
}
return $this->_plugins;
}