- md5
- 9b3105b9b8a8c1bfe52ea47fa40c83a3
- sha1
- aaabac52b5cd3458208abad7cf71c7e9ee32414c
- sha256
- 58128bd489d6fa250f76ff05bdd94b1962f363c86c6d46a570c2e993a2888147
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
<?php
/**
* @package Joomla.Plugin
* @subpackage Extension.namespacemap
*
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\Plugin\Extension\NamespaceMap\Extension;
use JNamespacePsr4Map;
use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Event\DispatcherInterface;
// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects
/**
* Joomla! namespace map creator / updater.
*
* @since 4.0.0
*/
final class NamespaceMap extends CMSPlugin
{
/**
* The namespace map file creator
*
* @var JNamespacePsr4Map
*/
private $fileCreator = null;
/**
* Constructor
*
* @param DispatcherInterface $dispatcher The object to observe
* @param JNamespacePsr4Map $map The namespace map creator
* @param array $config An optional associative array of configuration settings.
* Recognized key values include 'name', 'group', 'params', 'language'
* (this list is not meant to be comprehensive).
*
* @since 4.0.0
*/
public function __construct(DispatcherInterface $dispatcher, JNamespacePsr4Map $map, array $config = [])
{
$this->fileCreator = $map;
parent::__construct($dispatcher, $config);
}
/**
* Update / Create map on extension install
*
* @param Installer $installer Installer instance
* @param integer $eid Extension id
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterInstall($installer, $eid)
{
// Check that we have a valid extension
if ($eid) {
// Update / Create new map
$this->fileCreator->create();
}
}
/**
* Update / Create map on extension uninstall
*
* @param Installer $installer Installer instance
* @param integer $eid Extension id
* @param boolean $removed Installation result
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterUninstall($installer, $eid, $removed)
{
// Check that we have a valid extension and that it has been removed
if ($eid && $removed) {
// Update / Create new map
$this->fileCreator->create();
}
}
/**
* Update map on extension update
*
* @param Installer $installer Installer instance
* @param integer $eid Extension id
*
* @return void
*
* @since 4.0.0
*/
public function onExtensionAfterUpdate($installer, $eid)
{
// Check that we have a valid extension
if ($eid) {
// Update / Create new map
$this->fileCreator->create();
}
}
}
No other release has this exact content. See every version of this file.