Skip to content

Commit

Permalink
Check that transformer is a valid instance of TransformerAbstract
Browse files Browse the repository at this point in the history
  • Loading branch information
Thibaud Fabre committed Feb 13, 2015
1 parent 564aeee commit 4e21682
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Elements/FractalRenderingLayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use League\Fractal\Resource\Item;
use Symfony\Component\HttpFoundation\Request;
use Aztech\Layers\Layer;
use League\Fractal\TransformerAbstract;

class FractalRenderingLayer implements Layer
{
Expand All @@ -35,6 +36,10 @@ public function __construct(Container $container, Manager $manager, Layer $contr
} else {
$this->transformer = $container->resolve($this->transformer);
}

if (! ($this->transformer instanceof TransformerAbstract)) {
throw new \RuntimeException('Invalid transformer: ' . serialize($this->transformer));
}
}

public function __invoke(Request $request)
Expand Down

0 comments on commit 4e21682

Please sign in to comment.