mode, true)) { throw new GenerateCodeException(sprintf( 'Could not create output directory: %s', $dir )); } } /** * Ensures the existence of the output directory * * @throws LogicException * @throws GenerateCodeException */ protected function ensureOutputDirectory() { if (! $this->outputDirectory) { throw new LogicException('Cannot generate code without output directory'); } $this->ensureDirectory($this->outputDirectory); } /** * Set the output directory * * You should configure a psr-4 autoloader with the namespace `Laminas\Di\Generated` * to src/ in this directory. * * The compiler will attempt to create this directory if it does not exist * * @param string $dir The path to the output directory * @param null|int $mode The creation mode for the directory * @return $this Provides a fluent interface */ public function setOutputDirectory(string $dir, ?int $mode = null): self { $this->outputDirectory = $dir; if ($mode !== null) { $this->mode = $mode; } return $this; } public function getOutputDirectory(): ?string { return $this->outputDirectory; } }