src/Scope.php
public function transformPrimitiveResource()
    {
        if (! ($this->resource instanceof Primitive)) {
            throw new InvalidArgumentException(
                'Argument $resource should be an instance of League\Fractal\Resource\Primitive'
            );
        }

        $transformer = $this->resource->getTransformer();
        $data = $this->resource->getData();

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

        return $transformedData;
    }
public function transformPrimitiveResource()
    {
        if (! ($this->resource instanceof Primitive)) {
            throw new InvalidArgumentException(
                'Argument $resource should be an instance of League\Fractal\Resource\Primitive'
            );
        }

        $transformer = $this->resource->getTransformer();
        $data = $this->resource->getData();

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

        return $transformedData;
    }
public function transformPrimitiveResource ( ) { if ( ! ( $ this -> resource instanceof Primitive ) ) { throw new InvalidArgumentException ( 'Argument $resource should be an instance of League\Fractal\Resource\Primitive' ) ; } $ transformer = $ this -> resource -> getTransformer ( ) ; $ data = $ this -> resource -> getData ( ) ; if ( null === $ transformer ) { $ transformedData = $ data ; } elseif ( is_callable ( $ transformer ) ) { $ transformedData = call_user_func ( $ transformer , $ data ) ; } else { $ transformer -> setCurrentScope ( $ this ) ; $ transformedData = $ transformer -> transform ( $ data ) ; } return $ transformedData ; }
Transformer a primitive resource

@return mixed
Transformer a primitive resource