src/Scope.php
protected function fireTransformer($transformer, $data)
    {
        $includedData = [];

        if (is_callable($transformer)) {
            $transformedData = call_user_func($transformer, $data);
        } else {
            $transformer->setCurrentScope($this);
            $transformedData = $transformer->transform($data);
        }

        if ($this->transformerHasIncludes($transformer)) {
            $includedData = $this->fireIncludedTransformers($transformer, $data);
            $transformedData = $this->manager->getSerializer()->mergeIncludes($transformedData, $includedData);
        }

        //Stick only with requested fields
        $transformedData = $this->filterFieldsets($transformedData);

        return [$transformedData, $includedData];
    }
protected function fireTransformer($transformer, $data)
    {
        $includedData = [];

        if (is_callable($transformer)) {
            $transformedData = call_user_func($transformer, $data);
        } else {
            $transformer->setCurrentScope($this);
            $transformedData = $transformer->transform($data);
        }

        if ($this->transformerHasIncludes($transformer)) {
            $includedData = $this->fireIncludedTransformers($transformer, $data);
            $transformedData = $this->manager->getSerializer()->mergeIncludes($transformedData, $includedData);
        }

        //Stick only with requested fields
        $transformedData = $this->filterFieldsets($transformedData);

        return [$transformedData, $includedData];
    }
protected function fireTransformer ( $ transformer , $ data ) { $ includedData = [ ] ; if ( is_callable ( $ transformer ) ) { $ transformedData = call_user_func ( $ transformer , $ data ) ; } else { $ transformer -> setCurrentScope ( $ this ) ; $ transformedData = $ transformer -> transform ( $ data ) ; } if ( $ this -> transformerHasIncludes ( $ transformer ) ) { $ includedData = $ this -> fireIncludedTransformers ( $ transformer , $ data ) ; $ transformedData = $ this -> manager -> getSerializer ( ) -> mergeIncludes ( $ transformedData , $ includedData ) ; } //Stick only with requested fields $ transformedData = $ this -> filterFieldsets ( $ transformedData ) ; return [ $ transformedData , $ includedData ] ; }
Fire the main transformer.

@internal

@param TransformerAbstract|callable $transformer
@param mixed                        $data

@return array
Fire the main transformer .