Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401]
1 <?php 2 3 namespace Box\Spout\Writer\ODS\Creator; 4 5 use Box\Spout\Common\Manager\OptionsManagerInterface; 6 use Box\Spout\Writer\Common\Creator\InternalEntityFactory; 7 use Box\Spout\Writer\Common\Creator\ManagerFactoryInterface; 8 use Box\Spout\Writer\Common\Entity\Options; 9 use Box\Spout\Writer\Common\Manager\SheetManager; 10 use Box\Spout\Writer\Common\Manager\Style\StyleMerger; 11 use Box\Spout\Writer\ODS\Manager\Style\StyleManager; 12 use Box\Spout\Writer\ODS\Manager\Style\StyleRegistry; 13 use Box\Spout\Writer\ODS\Manager\WorkbookManager; 14 use Box\Spout\Writer\ODS\Manager\WorksheetManager; 15 16 /** 17 * Class ManagerFactory 18 * Factory for managers needed by the ODS Writer 19 */ 20 class ManagerFactory implements ManagerFactoryInterface 21 { 22 /** @var InternalEntityFactory */ 23 protected $entityFactory; 24 25 /** @var HelperFactory $helperFactory */ 26 protected $helperFactory; 27 28 /** 29 * @param InternalEntityFactory $entityFactory 30 * @param HelperFactory $helperFactory 31 */ 32 public function __construct(InternalEntityFactory $entityFactory, HelperFactory $helperFactory) 33 { 34 $this->entityFactory = $entityFactory; 35 $this->helperFactory = $helperFactory; 36 } 37 38 /** 39 * @param OptionsManagerInterface $optionsManager 40 * @return WorkbookManager 41 */ 42 public function createWorkbookManager(OptionsManagerInterface $optionsManager) 43 { 44 $workbook = $this->entityFactory->createWorkbook(); 45 46 $fileSystemHelper = $this->helperFactory->createSpecificFileSystemHelper($optionsManager, $this->entityFactory); 47 $fileSystemHelper->createBaseFilesAndFolders(); 48 49 $styleMerger = $this->createStyleMerger(); 50 $styleManager = $this->createStyleManager($optionsManager); 51 $worksheetManager = $this->createWorksheetManager($styleManager, $styleMerger); 52 53 return new WorkbookManager( 54 $workbook, 55 $optionsManager, 56 $worksheetManager, 57 $styleManager, 58 $styleMerger, 59 $fileSystemHelper, 60 $this->entityFactory, 61 $this 62 ); 63 } 64 65 /** 66 * @param StyleManager $styleManager 67 * @param StyleMerger $styleMerger 68 * @return WorksheetManager 69 */ 70 private function createWorksheetManager(StyleManager $styleManager, StyleMerger $styleMerger) 71 { 72 $stringsEscaper = $this->helperFactory->createStringsEscaper(); 73 $stringsHelper = $this->helperFactory->createStringHelper(); 74 75 return new WorksheetManager($styleManager, $styleMerger, $stringsEscaper, $stringsHelper); 76 } 77 78 /** 79 * @return SheetManager 80 */ 81 public function createSheetManager() 82 { 83 $stringHelper = $this->helperFactory->createStringHelper(); 84 85 return new SheetManager($stringHelper); 86 } 87 88 /** 89 * @param OptionsManagerInterface $optionsManager 90 * @return StyleManager 91 */ 92 private function createStyleManager(OptionsManagerInterface $optionsManager) 93 { 94 $styleRegistry = $this->createStyleRegistry($optionsManager); 95 96 return new StyleManager($styleRegistry); 97 } 98 99 /** 100 * @param OptionsManagerInterface $optionsManager 101 * @return StyleRegistry 102 */ 103 private function createStyleRegistry(OptionsManagerInterface $optionsManager) 104 { 105 $defaultRowStyle = $optionsManager->getOption(Options::DEFAULT_ROW_STYLE); 106 107 return new StyleRegistry($defaultRowStyle); 108 } 109 110 /** 111 * @return StyleMerger 112 */ 113 private function createStyleMerger() 114 { 115 return new StyleMerger(); 116 } 117 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body