Skip to content

Commit

Permalink
Avoid naming collision in TexyMultiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed May 2, 2023
1 parent 3b61a3a commit 56e584f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Texy/TexyMultiplier.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ final class TexyMultiplier
use Nette\SmartObject;

/**
* @var TexyFactory[]
* @var array<string, TexyFactory>
*/
private array $factories = [];

/**
* @var Texy\Texy[]
* @var array<string, Texy\Texy>
*/
private array $texy = [];
private array $instances = [];

private string $defaultMode;

Expand All @@ -43,14 +43,14 @@ public function getTexy(?string $mode = null): Texy\Texy
{
$mode ??= $this->defaultMode;

if (! isset($this->texy[$mode])) {
if (! isset($this->instances[$mode])) {
if (! isset($this->factories[$mode])) {
throw new \InvalidArgumentException("Missing Texy! factory for mode '{$mode}'.");
}
$this->texy[$mode] = $this->factories[$mode]->create();
$this->instances[$mode] = $this->factories[$mode]->create();
}

return $this->texy[$mode];
return $this->instances[$mode];
}

public function processBlock(string $text, ?string $mode = null): string
Expand Down

0 comments on commit 56e584f

Please sign in to comment.