pluginDirectory = $pluginDirectory; } public function write($manifests) { $this ->doWrite('autoload.php', $this->createLoader($manifests)) ->doWrite('services.php', $this->createServices($manifests)) ->doWrite('commands.php', $this->createCommands($manifests)) ->doWrite('twig-paths.php', $this->createTwigPathsMap($manifests)) ->doWrite('login.less', $this->createLoginLess($manifests)) ->doWrite('account.less', $this->createAccountLess($manifests)); return $this; } private function createLoginLess($manifests) { $buffer = <<pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'login.less'; if (is_file($filepath)) { $relativePath = $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'login.less'; $buffer .= <<pluginDirectory . DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'account.less'; if (is_file($filepath)) { $relativePath = $manifest->getName() . DIRECTORY_SEPARATOR . 'less' . DIRECTORY_SEPARATOR . 'account.less'; $buffer .= <<pluginDirectory . DIRECTORY_SEPARATOR . $file, $data)) { throw new RegistrationFailureException(sprintf('Failed to write %s', $file)); } return $this; } private function createLoader($manifests) { $buffer = <<getName() . DIRECTORY_SEPARATOR . "vendor" . DIRECTORY_SEPARATOR . "autoload.php"; $buffer .= <<getServices() as $service) { $class = $service['class']; $pluginBuffer .= <<register($class::create(\$app)); EOF; } $buffer .= $this->wrapWithConditionnal($manifest, $pluginBuffer); } $buffer .= <<getName(); return " if (\$app['plugins.manager']->isEnabled('$name')) {\n" . $wrapped . " }\n"; } private function createCommands($manifests) { $buffer = <<getCommands() as $command) { $class = $command['class']; $pluginBuffer .= <<command($class::create()); EOF; } $buffer .= $this->wrapWithConditionnal($manifest, $pluginBuffer); } $buffer .= <<quote('plugin-' . $manifest->getName()); $path = DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . 'views'; if (is_dir($this->pluginDirectory . $path)) { $path = $this->quote($path); $pluginBuffer .= " \$paths[$namespace] = __DIR__ . $path;\n"; } foreach ($manifest->getTwigPaths() as $path) { $path = $this->quote(DIRECTORY_SEPARATOR . $manifest->getName() . DIRECTORY_SEPARATOR . $path); $pluginBuffer .= " \$paths[] = __DIR__ . $path;\n"; } $buffer .= $this->wrapWithConditionnal($manifest, $pluginBuffer); } $buffer .= <<