Skip to content

Commit 86e2a07

Browse files
committed
remove unnecessary parameters
1 parent 08ce376 commit 86e2a07

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

src/Model/RenderJob.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,14 @@ public function postProcess(array $postProcessors, GeneratorConfiguration $gener
6464
/**
6565
* Execute the render job and render the class
6666
*
67-
* @param string $destination
6867
* @param GeneratorConfiguration $generatorConfiguration
6968
*
7069
* @throws FileSystemException
7170
* @throws RenderException
7271
*/
73-
public function render(string $destination, GeneratorConfiguration $generatorConfiguration): void
72+
public function render(GeneratorConfiguration $generatorConfiguration): void
7473
{
75-
$this->generateModelDirectory($destination, $this->classPath);
74+
$this->generateModelDirectory();
7675

7776
$class = $this->renderClass($generatorConfiguration);
7877

@@ -94,21 +93,13 @@ public function render(string $destination, GeneratorConfiguration $generatorCon
9493
/**
9594
* Generate the directory structure for saving a generated class
9695
*
97-
* @param string $destination
98-
* @param string $classPath
99-
*
10096
* @throws FileSystemException
10197
*/
102-
protected function generateModelDirectory(string $destination, string $classPath): void
98+
protected function generateModelDirectory(): void
10399
{
104-
$subDirectoryPath = '';
105-
foreach (explode('\\', $classPath) as $directory) {
106-
$subDirectoryPath .= "/$directory";
107-
$fullPath = $destination . $subDirectoryPath;
108-
109-
if (!is_dir($fullPath) && !mkdir($fullPath)) {
110-
throw new FileSystemException("Can't create path $fullPath");
111-
}
100+
$destination = dirname($this->fileName);
101+
if (!is_dir($destination) && !mkdir($destination, 0777, true)) {
102+
throw new FileSystemException("Can't create path $destination");
112103
}
113104
}
114105

src/ModelGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function generateModels(SchemaProviderInterface $schemaProvider, string $
117117
}
118118

119119
// render all collected classes
120-
$renderQueue->execute($destination, $this->generatorConfiguration, $this->postProcessors);
120+
$renderQueue->execute($this->generatorConfiguration, $this->postProcessors);
121121

122122
if ($this->generatorConfiguration->hasPrettyPrintEnabled()) {
123123
// @codeCoverageIgnoreStart

src/SchemaProcessor/RenderQueue.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,16 @@ public function addRenderJob(RenderJob $renderJob): self
3535
/**
3636
* Render all collected jobs of the RenderQueue and clear the queue
3737
*
38-
* @param string $destination
3938
* @param GeneratorConfiguration $generatorConfiguration
4039
* @param PostProcessorInterface[] $postProcessors
4140
*
4241
* @throws FileSystemException
4342
* @throws RenderException
4443
*/
45-
public function execute(
46-
string $destination,
47-
GeneratorConfiguration $generatorConfiguration,
48-
array $postProcessors
49-
): void {
44+
public function execute(GeneratorConfiguration $generatorConfiguration, array $postProcessors): void {
5045
foreach ($this->jobs as $job) {
5146
$job->postProcess($postProcessors, $generatorConfiguration);
52-
$job->render($destination, $generatorConfiguration);
47+
$job->render($generatorConfiguration);
5348
}
5449

5550
$this->jobs = [];

0 commit comments

Comments
 (0)