Skip to content

Commit

Permalink
Fixed bad design
Browse files Browse the repository at this point in the history
  • Loading branch information
bpolaszek committed Mar 8, 2017
1 parent cb5fb2b commit 8c05c62
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/Extractor/CallbackExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,7 @@ public function __invoke($key, $value): ContextElementInterface
{
$element = parent::__invoke($key, $value);
$callback = $this->callback;
$result = $callback($element);
if (null !== $result) {
if (!$result instanceof ContextElementInterface) {
throw new \RuntimeException(
sprintf("The callback should either return nothing or a %s class.", ContextElementInterface::class)
);
} else {
$element = $result;
}
}
$callback($element);
return $element;
}
}

0 comments on commit 8c05c62

Please sign in to comment.