custom/plugins/MaxiaTaxSwitch6/src/MaxiaTaxSwitch6.php line 16

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Maxia\MaxiaTaxSwitch6;
  3. use Maxia\MaxiaTaxSwitch6\Setup\Installer;
  4. use Maxia\MaxiaTaxSwitch6\Setup\Uninstaller;
  5. use Maxia\MaxiaTaxSwitch6\Setup\Updater;
  6. use Shopware\Core\Framework\Plugin;
  7. use Shopware\Core\Framework\Plugin\Context\InstallContext;
  8. use Shopware\Core\Framework\Plugin\Context\UninstallContext;
  9. use Shopware\Core\Framework\Plugin\Context\UpdateContext;
  10. use Symfony\Component\Config\FileLocator;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
  13. class MaxiaTaxSwitch6 extends Plugin
  14. {
  15.     public function build(ContainerBuilder $container): void
  16.     {
  17.         $container->setParameter('maxia.maxia_tax_switch_6.plugin_name''MaxiaTaxSwitch6');
  18.         $filename 'services.xml';
  19.         try {
  20.             if (class_exists('\Composer\InstalledVersions')) {
  21.                 $shopwareVersion \Composer\InstalledVersions::getVersion('shopware/core');
  22.                 if ($shopwareVersion && version_compare($shopwareVersion'6.4.18''<')) {
  23.                     $filename 'services-6417.xml';
  24.                 }
  25.             }
  26.         } catch (\OutOfBoundsException $e) {
  27.             // dev environment
  28.         }
  29.         $loader = new XmlFileLoader($container, new FileLocator(__DIR__ '/DependencyInjection'));
  30.         $loader->load($filename);
  31.         parent::build($container);
  32.     }
  33.     /**
  34.      * {@inheritdoc}
  35.      */
  36.     public function update(UpdateContext $updateContext): void
  37.     {
  38.         parent::update($updateContext);
  39.         $updater = new Updater($this->container);
  40.         $updater->update($updateContext);
  41.     }
  42.     /**
  43.      * {@inheritdoc}
  44.      */
  45.     public function postUpdate(UpdateContext $updateContext): void
  46.     {
  47.         parent::postUpdate($updateContext);
  48.         $updater = new Updater($this->container);
  49.         $updater->postUpdate($updateContext);
  50.     }
  51.     /**
  52.      * {@inheritdoc}
  53.      */
  54.     public function install(InstallContext $installContext): void
  55.     {
  56.         parent::install($installContext);
  57.         $installer = new Installer($this->container);
  58.         $installer->install($installContext);
  59.     }
  60.     /**
  61.      * {@inheritdoc}
  62.      */
  63.     public function uninstall(UninstallContext $uninstallContext): void
  64.     {
  65.         parent::uninstall($uninstallContext);
  66.         $uninstaller = new Uninstaller($this->container);
  67.         $uninstaller->uninstall($uninstallContext);
  68.     }
  69. }