Skip to content

Commit

Permalink
Merge pull request #258 from Arzaroth/add-references
Browse files Browse the repository at this point in the history
Turn off location of strings
  • Loading branch information
oscarotero committed Apr 24, 2020
2 parents 737ff43 + afaa9ba commit 94d258b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Scanner/CodeScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ abstract class CodeScanner extends Scanner
{
protected $ignoreInvalidFunctions = false;

protected $addReferences = true;

protected $commentsPrefixes = [];

protected $functions = [
Expand Down Expand Up @@ -63,6 +65,13 @@ public function ignoreInvalidFunctions($ignore = true): self
return $this;
}

public function addReferences($enabled = true): self
{
$this->addReferences = $enabled;

return $this;
}

public function extractCommentsStartingWith(string ...$prefixes): self
{
$this->commentsPrefixes = $prefixes;
Expand Down Expand Up @@ -93,7 +102,7 @@ protected function handleFunction(ParsedFunction $function)

$translation = call_user_func([$this, $handler], $function);

if ($translation) {
if ($translation && $this->addReferences) {
$translation->getReferences()->add($function->getFilename(), $function->getLine());
}
}
Expand Down

0 comments on commit 94d258b

Please sign in to comment.