src/Fractal.php
public function getResource()
    {
        $resourceClass = 'League\\Fractal\\Resource\\'.ucfirst($this->dataType);

        if (! class_exists($resourceClass)) {
            throw new InvalidTransformation();
        }

        if (is_string($this->transformer)) {
            $this->transformer = new $this->transformer;
        }

        $resource = new $resourceClass($this->data, $this->transformer, $this->resourceName);

        $resource->setMeta($this->meta);

        if (! is_null($this->paginator)) {
            $resource->setPaginator($this->paginator);
        }

        if (! is_null($this->cursor)) {
            $resource->setCursor($this->cursor);
        }

        return $resource;
    }
public function getResource()
    {
        $resourceClass = 'League\\Fractal\\Resource\\'.ucfirst($this->dataType);

        if (! class_exists($resourceClass)) {
            throw new InvalidTransformation();
        }

        if (is_string($this->transformer)) {
            $this->transformer = new $this->transformer;
        }

        $resource = new $resourceClass($this->data, $this->transformer, $this->resourceName);

        $resource->setMeta($this->meta);

        if (! is_null($this->paginator)) {
            $resource->setPaginator($this->paginator);
        }

        if (! is_null($this->cursor)) {
            $resource->setCursor($this->cursor);
        }

        return $resource;
    }
public function getResource ( ) { $ resourceClass = 'League\\Fractal\\Resource\\' . ucfirst ( $ this -> dataType ) ; if ( ! class_exists ( $ resourceClass ) ) { throw new InvalidTransformation ( ) ; } if ( is_string ( $ this -> transformer ) ) { $ this -> transformer = new $ this -> transformer ; } $ resource = new $ resourceClass ( $ this -> data , $ this -> transformer , $ this -> resourceName ) ; $ resource -> setMeta ( $ this -> meta ) ; if ( ! is_null ( $ this -> paginator ) ) { $ resource -> setPaginator ( $ this -> paginator ) ; } if ( ! is_null ( $ this -> cursor ) ) { $ resource -> setCursor ( $ this -> cursor ) ; } return $ resource ; }
Get the resource.

@return \League\Fractal\Resource\ResourceInterface

@throws \Spatie\Fractalistic\Exceptions\InvalidTransformation
Get the resource .