/** * @param StackFrameReadOnlyInterface|null $previous */ public function __construct(StackFrameReadOnlyInterface $previous = null) { settype($level, 'int'); $level = $previous === null ? 1 : $previous->getLevel() + 1; // debug check $isOk = $level <= 2 || $previous !== null && $previous->getRelationship() !== null; $isOk ?: Exceptions::throwLogicException(); $this->level = $level; $this->previous = $previous; }
/** * @param Frame $current * * @return void */ private function setResourceCompleted(Frame $current) { // Add resource if it is a main resource (even if it has no fields) or // if field set allows any fields for this type (filter out resources with no attributes and relationships) if ($current->getLevel() === 1 || $this->parameterAnalyzer->hasSomeFields($current->getResource()->getType()) === true) { $resourceObject = $current->getResource(); $this->document->setResourceCompleted($resourceObject); } }