/** * Determine if a transformer has any available includes. * * @internal * * @param TransformerAbstract|callable $transformer * * @return bool */ protected function transformerHasIncludes($transformer) { $parentScope = $this->getParent(); if (!$parentScope instanceof Scope) { return parent::transformerHasIncludes($transformer); } if ($parentScope->getDunglasResource()->getShortName() === $this->getDunglasResource()->getShortName()) { return true; } if ($parentScope->getParent() instanceof Scope) { $embedsRequest = array_keys($transformer->getRequestEmbeds()); $transformer->setDefaultIncludes([]); return in_array(strtolower($this->getIdentifierWithoutSourceIdentifier()), $embedsRequest); } return true; }