Skip to content

Commit 276aacb

Browse files
authored
Merge pull request #14 from php-etl/fix/interpreter
Fixed the usage of the interpreter
2 parents edccec5 + e36e241 commit 276aacb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Service.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,26 +74,28 @@ public function validate(array $config): bool
7474
*/
7575
public function compile(array $config): Factory\Repository\TransformerMapper
7676
{
77+
$interpreter = clone $this->interpreter;
78+
7779
if (array_key_exists('expression_language', $config)
7880
&& is_array($config['expression_language'])
7981
&& count($config['expression_language'])
8082
) {
8183
foreach ($config['expression_language'] as $provider) {
82-
$this->interpreter->registerProvider(new $provider);
84+
$interpreter->registerProvider(new $provider);
8385
}
8486
}
8587

8688
try {
8789
if (array_key_exists('conditional', $config)) {
88-
$conditionalFactory = new Factory\ConditionalMapper($this->interpreter, $this->additionalExpressionVariables);
90+
$conditionalFactory = new Factory\ConditionalMapper($interpreter, $this->additionalExpressionVariables);
8991

9092
return $conditionalFactory->compile($config['conditional']);
9193
} elseif (array_key_exists('map', $config)) {
92-
$arrayFactory = new Factory\ArrayMapper($this->interpreter, $this->additionalExpressionVariables);
94+
$arrayFactory = new Factory\ArrayMapper($interpreter, $this->additionalExpressionVariables);
9395

9496
return $arrayFactory->compile($config['map']);
9597
} elseif (array_key_exists('object', $config)) {
96-
$objectFactory = new Factory\ObjectMapper($this->interpreter, $this->additionalExpressionVariables);
98+
$objectFactory = new Factory\ObjectMapper($interpreter, $this->additionalExpressionVariables);
9799

98100
return $objectFactory->compile($config['object']);
99101
} else {

0 commit comments

Comments
 (0)