public function transform($output, $transformer, $serializer = null)
    {
        if ($serializer !== null) {
            $this->fractal->setSerializer($this->createSerializer($serializer));
        }

        $collector = [];
        foreach ($transformer as $transform) {
            if ($transform != null) {
                $resource       = new Collection($output, $this->createTransformer($transform));
                $collection     = $this->fractal->createData($resource)->toArray();
                $transformed    = $collection['data'] ?? $collection;
                $collector      = array_map(
                    function ($item_collector, $item_transformed) {
                        if ($item_collector === null) {
                            $item_collector = [];
                        }

                        return array_merge($item_collector, $item_transformed);
                    }, $collector, $transformed
                );
            }
        }

        return $collector;
    }
public function transform($output, $transformer, $serializer = null)
    {
        if ($serializer !== null) {
            $this->fractal->setSerializer($this->createSerializer($serializer));
        }

        $collector = [];
        foreach ($transformer as $transform) {
            if ($transform != null) {
                $resource       = new Collection($output, $this->createTransformer($transform));
                $collection     = $this->fractal->createData($resource)->toArray();
                $transformed    = $collection['data'] ?? $collection;
                $collector      = array_map(
                    function ($item_collector, $item_transformed) {
                        if ($item_collector === null) {
                            $item_collector = [];
                        }

                        return array_merge($item_collector, $item_transformed);
                    }, $collector, $transformed
                );
            }
        }

        return $collector;
    }
public function transform ( $ output , $ transformer , $ serializer = null ) { if ( $ serializer !== null ) { $ this -> fractal -> setSerializer ( $ this -> createSerializer ( $ serializer ) ) ; } $ collector = [ ] ; foreach ( $ transformer as $ transform ) { if ( $ transform != null ) { $ resource = new Collection ( $ output , $ this -> createTransformer ( $ transform ) ) ; $ collection = $ this -> fractal -> createData ( $ resource ) -> toArray ( ) ; $ transformed = $ collection [ 'data' ] ?? $ collection ; $ collector = array_map ( function ( $ item_collector , $ item_transformed ) { if ( $ item_collector === null ) { $ item_collector = [ ] ; } return array_merge ( $ item_collector , $ item_transformed ) ; } , $ collector , $ transformed ) ; } } return $ collector ; }
Transform output using the given transformer and serializer.

@param  mixed $output
@param  mixed $transformer
@param  mixed $serializer
@return array
Transform output using the given transformer and serializer .