Skip to content

Commit

Permalink
Convert inject methods to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Kuhlmay authored and PKuhlmay committed Aug 2, 2024
1 parent 0d20b76 commit 6062e5d
Showing 1 changed file with 27 additions and 62 deletions.
89 changes: 27 additions & 62 deletions Classes/Controller/BuilderModuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,38 @@
use TYPO3\CMS\Core\Utility\PathUtility;
use TYPO3\CMS\Extbase\Http\ForwardResponse;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;

class BuilderModuleController extends ActionController
{
private FileGenerator $fileGenerator;

private ExtensionBuilderConfigurationManager $extensionBuilderConfigurationManager;

private ExtensionInstallationStatus $extensionInstallationStatus;

private ExtensionSchemaBuilder $extensionSchemaBuilder;

private ExtensionService $extensionService;

private ExtensionValidator $extensionValidator;

private ExtensionRepository $extensionRepository;

private ModuleTemplateFactory $moduleTemplateFactory;
public function __construct(
FileGenerator $fileGenerator,
IconFactory $iconFactory,
PageRenderer $pageRenderer,
ExtensionInstallationStatus $extensionInstallationStatus,
ExtensionSchemaBuilder $extensionSchemaBuilder,
ExtensionService $extensionService,
ModuleTemplateFactory $moduleTemplateFactory,
ExtensionValidator $extensionValidator,
ExtensionRepository $extensionRepository,
)
{
$this->fileGenerator = $fileGenerator;
$this->iconFactory = $iconFactory;
$this->pageRenderer = $pageRenderer;
$this->extensionInstallationStatus = $extensionInstallationStatus;
$this->extensionSchemaBuilder = $extensionSchemaBuilder;
$this->extensionService = $extensionService;
$this->moduleTemplateFactory = $moduleTemplateFactory;
$this->extensionValidator = $extensionValidator;
$this->extensionRepository = $extensionRepository;
}

private ExtensionBuilderConfigurationManager $extensionBuilderConfigurationManager;
private ModuleTemplate $moduleTemplate;

private PageRenderer $pageRenderer;

private IconFactory $iconFactory;

/**
* Settings from various sources:
Expand All @@ -78,58 +85,16 @@ class BuilderModuleController extends ActionController
*/
protected array $extensionBuilderSettings = [];

public function injectFileGenerator(FileGenerator $fileGenerator): void
{
$this->fileGenerator = $fileGenerator;
}

public function injectExtensionBuilderConfigurationManager(
ExtensionBuilderConfigurationManager $configurationManager
): void {
$this->extensionBuilderConfigurationManager = $configurationManager;
$this->extensionBuilderSettings = $this->extensionBuilderConfigurationManager->getSettings();
}

public function injectExtensionInstallationStatus(ExtensionInstallationStatus $extensionInstallationStatus): void
{
$this->extensionInstallationStatus = $extensionInstallationStatus;
}

public function injectExtensionSchemaBuilder(ExtensionSchemaBuilder $extensionSchemaBuilder): void
{
$this->extensionSchemaBuilder = $extensionSchemaBuilder;
}

public function injectExtensionService(ExtensionService $extensionService): void
{
$this->extensionService = $extensionService;
}

public function injectExtensionValidator(ExtensionValidator $extensionValidator): void
{
$this->extensionValidator = $extensionValidator;
}

public function injectExtensionRepository(ExtensionRepository $extensionRepository): void
{
$this->extensionRepository = $extensionRepository;
}

public function injectModuleTemplateFactory(ModuleTemplateFactory $moduleTemplateFactory): void
{
$this->moduleTemplateFactory = $moduleTemplateFactory;
}

public function injectPageRenderer(PageRenderer $pageRenderer): void
{
$this->pageRenderer = $pageRenderer;
}

public function injectIconFactory(IconFactory $iconFactory): void
{
$this->iconFactory = $iconFactory;
}

/**
* @return void
*/
public function initializeAction(): void
{
$this->fileGenerator->setSettings($this->extensionBuilderSettings);
Expand Down

0 comments on commit 6062e5d

Please sign in to comment.