getFilePath('projectPhpFpmDockerfile'); if (!$projectPhpFpmDockerfile instanceof SpinnerFilePath) { throw new \Exception('Project PHP-FPM Dockerfile not found'); } return parent::__construct($projectPhpFpmDockerfile, $config); } /** * @throws \Exception */ public function build(InputInterface $input): PHPDockerFileBuilder { $this->setInitialContent(); $this->content = str_replace('${PHP_VERSION}', (string) $this->config->getPhpVersion($input), $this->content); if ($this->config->isNodeEnabled($input)) { $this->addNewLine(); $this->content .= file_get_contents($this->config->getFilePaths()->get('nodeDockerfileTemplate')->getAbsolutePath()); $this->content = str_replace('${NODE_VERSION}', (string) $this->config->getNodeVersion($input), $this->content); } if ($this->config->isXdebugEnabled($input)) { $this->addNewLine(); $this->content .= file_get_contents($this->config->getFilePaths()->get('xdebugDockerfileTemplate')->getAbsolutePath()); file_put_contents( (new SpinnerFilePath(sprintf('data/environments/%s/php-fpm/xdebug.ini', $input->getArgument('name'))))->getProvidedPath(), file_get_contents($this->config->getFilePaths()->get('xdebugIniTemplate')->getAbsolutePath()) ); } return $this; } private function setInitialContent(): void { $this->content = file_get_contents( $this->config->getFilePaths()->get(DataPathInterface::CONFIG_PHP_FPM_DOCKERFILE)->getAbsolutePath() ); } }