vendor/codefog/contao-member_export/src/CodefogMemberExportBundle.php line 17

Open in your IDE?
  1. <?php
  2. /*
  3.  * Member Export bundle for Contao Open Source CMS.
  4.  *
  5.  * @copyright  Copyright (c) 2017, Codefog
  6.  * @author     Codefog <https://codefog.pl>
  7.  * @license    MIT
  8.  */
  9. namespace Codefog\MemberExportBundle;
  10. use Codefog\MemberExportBundle\DependencyInjection\Compiler\ExporterPass;
  11. use Symfony\Component\DependencyInjection\ContainerBuilder;
  12. use Symfony\Component\HttpKernel\Bundle\Bundle;
  13. class CodefogMemberExportBundle extends Bundle
  14. {
  15.     /**
  16.      * {@inheritdoc}
  17.      */
  18.     public function build(ContainerBuilder $container)
  19.     {
  20.         $exporterPass = new ExporterPass('codefog_member_export.registry''codefog_member_export.exporter');
  21.         $this->handleExcelServices($exporterPass);
  22.         $container->addCompilerPass($exporterPass);
  23.     }
  24.     /**
  25.      * Exclude the Excel services if the required class is not found.
  26.      *
  27.      * @param ExporterPass $exporterPass
  28.      *
  29.      * @codeCoverageIgnore
  30.      */
  31.     private function handleExcelServices(ExporterPass $exporterPass)
  32.     {
  33.         if (!\class_exists('PhpOffice\PhpSpreadsheet\Spreadsheet')) {
  34.             $exporterPass->setExcluded(['codefog_member_export.exporter.excel5''codefog_member_export.exporter.excel2007']);
  35.         }
  36.     }
  37. }