/** * Adds a plugin * * @param Plugin $plugin * @return FileProfile */ public function addPlugin(Plugin $plugin) { $this->plugins[] = $plugin; if ($plugin instanceof VersionProvider) { foreach ($plugin->getProvidedVersions() as $version) { $this->addFileVersion($version, $plugin); } } return $this; }
/** * @param Plugin $plugin * @param array $profiles */ private function setResolverFunction(Plugin $plugin, $profiles) { if (!$profiles) { $resolverFunc = function ($profile) { return true; }; } else { $resolverFunc = function ($profile) use($profiles) { return (bool) in_array($profile, $profiles); }; } $plugin->setBelongsToProfileResolver($resolverFunc); }
/** * @param Plugin $plugin * @param array $profiles Profiles to add to, empty array to add to all profiles * @param string $name * @return FileLibrary */ public function addPlugin(Plugin $plugin, $profiles = array(), $name = null) { $plugin->attachTo($this); $this->pluginManager->addPlugin($plugin, $profiles, $name); return $this; }