Complete missing docblocks and fix incorrect ones
parent
3b519e44c4
commit
3e1519cde0
|
@ -165,11 +165,25 @@ class EventDispatcher
|
|||
$className::$methodName($event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a listener for a particular event
|
||||
*
|
||||
* @param string $eventName The event name - typically a constant
|
||||
* @param Callable $listener A callable expecting an event argument
|
||||
* @param integer $priority A higher value represents a higher priority
|
||||
*/
|
||||
protected function addListener($eventName, $listener, $priority = 0)
|
||||
{
|
||||
$this->listeners[$eventName][$priority][] = $listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds object methods as listeners for the events in getSubscribedEvents
|
||||
*
|
||||
* @see EventSubscriberInterface
|
||||
*
|
||||
* @param EventSubscriberInterface $subscriber
|
||||
*/
|
||||
public function addSubscriber(EventSubscriberInterface $subscriber)
|
||||
{
|
||||
foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
|
||||
|
@ -185,6 +199,12 @@ class EventDispatcher
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves all listeners for a given event
|
||||
*
|
||||
* @param Event $event
|
||||
* @return array All listeners: callables and scripts
|
||||
*/
|
||||
protected function getListeners(Event $event)
|
||||
{
|
||||
$scriptListeners = $this->getScriptListeners($event);
|
||||
|
@ -201,6 +221,8 @@ class EventDispatcher
|
|||
}
|
||||
|
||||
/**
|
||||
* Finds all listeners defined as scripts in the package
|
||||
*
|
||||
* @param Event $event Event object
|
||||
* @return array Listeners
|
||||
*/
|
||||
|
|
|
@ -45,6 +45,9 @@ class PluginManager
|
|||
$this->io = $io;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all plugins from currently installed plugin packages
|
||||
*/
|
||||
public function loadInstalledPlugins()
|
||||
{
|
||||
$repo = $this->composer->getRepositoryManager()->getLocalRepository();
|
||||
|
@ -59,7 +62,7 @@ class PluginManager
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds plugin
|
||||
* Adds a plugin, activates it and registers it with the event dispatcher
|
||||
*
|
||||
* @param PluginInterface $plugin plugin instance
|
||||
*/
|
||||
|
@ -73,11 +76,25 @@ class PluginManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all currently active plugin instances
|
||||
*
|
||||
* @return array plugins
|
||||
*/
|
||||
public function getPlugins()
|
||||
{
|
||||
return $this->plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively generates a map of package names to packages for all deps
|
||||
*
|
||||
* @param Pool $pool Package pool of installed packages
|
||||
* @param array $collected Current state of the map for recursion
|
||||
* @param PackageInterface $package The package to analyze
|
||||
*
|
||||
* @return array Map of package names to packages
|
||||
*/
|
||||
protected function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
|
||||
{
|
||||
$requires = array_merge(
|
||||
|
@ -96,6 +113,16 @@ class PluginManager
|
|||
return $collected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves a package link to a package in the installed pool
|
||||
*
|
||||
* Since dependencies are already installed this should always find one.
|
||||
*
|
||||
* @param Pool $pool Pool of installed packages only
|
||||
* @param Link $link Package link to look up
|
||||
*
|
||||
* @return PackageInterface|null The found package
|
||||
*/
|
||||
protected function lookupInstalledPackage(Pool $pool, Link $link)
|
||||
{
|
||||
$packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
|
||||
|
@ -103,6 +130,14 @@ class PluginManager
|
|||
return (!empty($packages)) ? $packages[0] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a plugin package, activate it etc.
|
||||
*
|
||||
* If it's of type composer-installer it is registered as an installer
|
||||
* instead for BC
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
*/
|
||||
public function registerPackage(PackageInterface $package)
|
||||
{
|
||||
$oldInstallerPlugin = ($package->getType() === 'composer-installer');
|
||||
|
@ -149,6 +184,12 @@ class PluginManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the path a package is installed to.
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @return string Install path
|
||||
*/
|
||||
public function getInstallPath(PackageInterface $package)
|
||||
{
|
||||
$targetDir = $package->getTargetDir();
|
||||
|
@ -156,6 +197,14 @@ class PluginManager
|
|||
return $this->getPackageBasePath($package) . ($targetDir ? '/'.$targetDir : '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the base path a package gets installed into.
|
||||
*
|
||||
* Does not take targetDir into account.
|
||||
*
|
||||
* @param PackageInterface $package
|
||||
* @return string Base path
|
||||
*/
|
||||
protected function getPackageBasePath(PackageInterface $package)
|
||||
{
|
||||
$vendorDir = rtrim($this->composer->getConfig()->get('vendor-dir'), '/');
|
||||
|
|
|
@ -38,10 +38,8 @@ class PreFileDownloadEvent extends Event
|
|||
* Constructor.
|
||||
*
|
||||
* @param string $name The event name
|
||||
* @param Composer $composer The composer object
|
||||
* @param IOInterface $io The IOInterface object
|
||||
* @param boolean $devMode Whether or not we are in dev mode
|
||||
* @param OperationInterface $operation The operation object
|
||||
* @param RemoteFilesystem $rfs
|
||||
* @param string $processedUrl
|
||||
*/
|
||||
public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
|
||||
{
|
||||
|
@ -53,7 +51,7 @@ class PreFileDownloadEvent extends Event
|
|||
/**
|
||||
* Returns the remote filesystem
|
||||
*
|
||||
* @return OperationInterface
|
||||
* @return RemoteFilesystem
|
||||
*/
|
||||
public function getRemoteFilesystem()
|
||||
{
|
||||
|
@ -62,6 +60,8 @@ class PreFileDownloadEvent extends Event
|
|||
|
||||
/**
|
||||
* Sets the remote filesystem
|
||||
*
|
||||
* @param RemoteFilesystem $rfs
|
||||
*/
|
||||
public function setRemoteFilesystem(RemoteFilesystem $rfs)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue