Fix transformer handling of closures
This commit is contained in:
parent
5a1cceb9d2
commit
b19ce4df7c
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Pterodactyl\Transformers\Api;
|
namespace Pterodactyl\Transformers\Api;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
@ -69,7 +70,9 @@ abstract class Transformer extends TransformerAbstract
|
||||||
*/
|
*/
|
||||||
protected function item($data, $transformer, $resourceKey = null)
|
protected function item($data, $transformer, $resourceKey = null)
|
||||||
{
|
{
|
||||||
self::assertSameNamespace($transformer);
|
if (!$transformer instanceof Closure) {
|
||||||
|
self::assertSameNamespace($transformer);
|
||||||
|
}
|
||||||
|
|
||||||
$item = parent::item($data, $transformer, $resourceKey);
|
$item = parent::item($data, $transformer, $resourceKey);
|
||||||
|
|
||||||
|
@ -89,7 +92,9 @@ abstract class Transformer extends TransformerAbstract
|
||||||
*/
|
*/
|
||||||
protected function collection($data, $transformer, $resourceKey = null)
|
protected function collection($data, $transformer, $resourceKey = null)
|
||||||
{
|
{
|
||||||
self::assertSameNamespace($transformer);
|
if (!$transformer instanceof Closure) {
|
||||||
|
self::assertSameNamespace($transformer);
|
||||||
|
}
|
||||||
|
|
||||||
$collection = parent::collection($data, $transformer, $resourceKey);
|
$collection = parent::collection($data, $transformer, $resourceKey);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue