Skip to content

Commit

Permalink
refactor(twig.gen): generated -> count
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Aug 25, 2018
1 parent 964ffbe commit 7c5767a
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/Generator/TwigGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct(array $templatePaths, string $cachePath)
*/
public function generate(string $targetPath, array $parameters, CollisionHandlerInterface $handler = null): int
{
$generated = 0;
$count = 0;

if (!$this->twig) {
$this->initTwig();
Expand All @@ -75,13 +75,13 @@ public function generate(string $targetPath, array $parameters, CollisionHandler
$processed[$relativePath] = true;

if ($this->shouldGenerate($template, $parameters)) {
$generated += (int) $this->doGenerate($relativePath, $targetPath, $parameters, $handler);
$count += (int) $this->doGenerate($relativePath, $targetPath, $parameters, $handler);
}
}

$this->pathUtil->createBinaries($parameters['bin'] ?? [], $parameters['path'] ?? '');

return $generated;
return $count;
}

public function generateTests(array $testMetadata, array $parameters): int
Expand All @@ -90,7 +90,7 @@ public function generateTests(array $testMetadata, array $parameters): int
$this->initTwig();
}

$generated = 0;
$count = 0;

foreach ($testMetadata as $metadata) {
// Skip existing
Expand All @@ -99,11 +99,10 @@ public function generateTests(array $testMetadata, array $parameters): int
}

$content = $this->twig->render('tests/test.twig', $metadata + $parameters);

$generated += (int) $this->pathUtil->writeFile($targetFile, $content);
$count += (int) $this->pathUtil->writeFile($targetFile, $content);
}

return $generated;
return $count;
}

public function generateDocs(array $docsMetadata, array $parameters): int
Expand Down

0 comments on commit 7c5767a

Please sign in to comment.