pluginDirectory = $pluginDirectory; } public function write($manifests) { $this ->doWrite('autoload.php', $this->createLoader($manifests)) ->doWrite('services.php', $this->createServices($manifests)); return $this; } private function doWrite($file, $data) { if (false === file_put_contents($this->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']; $buffer .= <<register($class::create(\$app)); EOF; } } $buffer .= <<