Determine if a transformer has any available includes.

@author Morten Rugaard <moru@nodes.dk>

@param  \Nodes\Api\Transformer\TransformerAbstract|\League\Fractal\TransformerAbstract|callable $transformer
@return bool
553418
protected function transformerHasIncludes($transformer)
    {
        if (! $transformer instanceof NodesTransformerAbstract &&
            ! $transformer instanceof FractalTransformerAbstract) {
            return false;
        }

        $defaultIncludes = $transformer->getDefaultIncludes();
        $availableIncludes = $transformer->getAvailableIncludes();

        return ! empty($defaultIncludes) || ! empty($availableIncludes);
    }
1164646
public static function transform($record, $includes = [])
    {
        $model_name = class_basename(get_class($record));
        $transformer = sprintf('\App\Transformers\%sTransformer', $model_name);

        $fractal = new self();

        if ($includes) {
            $fractal->manager->parseIncludes($includes);
        }

        try {
            return $fractal->item($record, new $transformer, $model_name);
        } catch (\Exception $e) {
            //Transformer class doesn't exist
            return [];
        }
    }
25447
public function getTransformer($value): Transformer
    {
        foreach ($this->getAllTransformers() as $transformer) {
            if ($transformer->canTransform($value)) {
                return $transformer;
            }
        }

        throw Untransformable::noTransformerFound($value);
    }
532419
public function hasParser($parser)
    {
        if ($parser instanceof ValueParserInterface) {
            $parser = $parser->getName();
        }

        return array_key_exists($parser, $this->parsers);
    }
1032074
public function item($model, $transformer = null)
    {

        // Prevent error if include dont work
        // This only returns null
        if ( ! $model ) {
            return $this->formatOutput(null);
        }

        // Check if we should call this function on another transformer
        if ( $transformer ) {
            return $transformer->item( $model );
        }

        // Format output to api
        return $this->formatOutput( $this->callTransform( $model ) );
    }
488978
protected <R, T extends Transformer<Transformed<R>>> Iterable<T> getTransformer(Class<T> transformerClass) {
        return Providers.getAllRankedSortedProviders(manager, transformerClass);
    }
867157
public static function hasLogger($logger)
    {
        if ($logger instanceof Logger) {
            $index = array_search($logger, self::$loggers, true);

            return false !== $index;
        } else {
            return isset(self::$loggers[$logger]);
        }
    }
824313
protected function fireIncludedTransformers($transformer, $data)
    {
        $this->availableIncludes = $transformer->getAvailableIncludes();

        return $transformer->processIncludedResources($this, $data) ?: [];
    }
647730
final public function addTransformer(Transformer $transformer)
    {
        if ($this->hasTransformer($transformer)) {
            throw new DuplicateTransformerException('Transformer already added.');
        }

        $this->transformers[spl_object_hash($transformer)] = $transformer;

        return $this;
    }
557906
private function hasOperatorInStack()
    {
        $hasOperatorInStack = false;
        if(!$this->operatorStack->isEmpty()) {
            $top = $this->operatorStack->top();
            if(Token::T_OPERATOR == $top->getType()) {
                $hasOperatorInStack = true;
            }
        }

        return $hasOperatorInStack;
    }
886782
public function addRenderer(RendererAbstract $renderer)
    {
        $extension = $renderer->getExtension();

        if (isset($this->renderer[$extension])) {
            return false;
        }
        
        $this->renderer[$extension] = $renderer;
        return true;
    }
1028300
protected function transform($instance, string $transformer, ?string $serializer = null, array $options = [])
    {
        if (\is_null($serializer)) {
            $serializer = $transformer;
        }

        return $this->serializeWith(
            $this->transformWith($instance, $transformer, $options),
            $serializer,
            $options
        );
    }
208138
public function hasArguments($includeBase = true)
    {
        Assert::boolean($includeBase, 'The parameter $includeBase must be a boolean. Got: %s');

        if (count($this->arguments) > 0) {
            return true;
        }

        if ($includeBase && $this->baseFormat) {
            return $this->baseFormat->hasArguments();
        }

        return false;
    }
144273
public function setTransformer($transformer)
    {
        if ($transformer !== null) {
            if (!$this->isValidTransformer($transformer)) {
                throw new InvalidTransformerException('Transformer must be a callable or implement TransformerInterface');
            }
        }

        $this->transformer = $transformer;

        return $this;
    }
482767
public function transformCollection($items, $includes = [], TransformerContract $transformer = null, $meta = [])
    {
        $this->fractal_manager->parseIncludes($includes);
        $transformer = is_null($transformer) ? $this->getTransformer() : $transformer;
        $resource = new Collection($items, $transformer, $this->getModelName());

        $resource->setMeta($meta);
        if ($items instanceof LengthAwarePaginator) {
            $resource->setPaginator(new IlluminatePaginatorAdapter($items));
        }

        return $this->fractal_manager->createData($resource)->toArray();
    }
467236
static function HasReplacement($placeholder, Interfaces\IRealizer $realizer = null) {
        return self::RetrieveRealizer($realizer)->HasReplacement($placeholder);
    }
435048
public function hasOrderLine($orderLine): bool
    {
        if ($orderLine instanceof OrderLineInterface) {
            $orderLine = $orderLine->getExternalId();
        }

        return $this->orderLines->exists(function ($key, OrderLineInterface $element) use ($orderLine) {
            return $element->getExternalId() === $orderLine;
        });
    }