Skip to content

Commit

Permalink
integrate umpirsky#53 (debugging)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Droz committed Jul 20, 2018
1 parent e386a34 commit 5917abd
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Twig/Gettext/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ protected function reset()
public function addTemplate($path)
{
$this->environment->loadTemplate($path);
if ($this->environment->isDebug()) {
fprintf(STDERR, $path . PHP_EOL);
}
}

public function addGettextParameter($parameter)
Expand All @@ -81,6 +84,10 @@ public function extract()
$command .= ' ' . $this->environment->getCache() . '/*/*.php';

$error = 0;
if ($this->environment->isDebug()) {
fprintf(STDERR, $command . PHP_EOL);
}

$output = system($command, $error);
if (0 !== $error) {
throw new \RuntimeException(sprintf(
Expand All @@ -95,6 +102,8 @@ public function extract()
public function __destruct()
{
$filesystem = new Filesystem();
$filesystem->remove($this->environment->getCache());
if (! $this->environment->isDebug()) {
$filesystem->remove($this->environment->getCache());
}
}
}

0 comments on commit 5917abd

Please sign in to comment.