/** * @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; }
/** * If relationship from 'parent' to 'current' resource passes field set filter. * * @param Frame $current * @param Frame $previous * * @return bool */ private function isRelationshipInFieldSet(Frame $current, Frame $previous) { $parentType = $previous->getResource()->getType(); $parameters = $this->parameterAnalyzer->getParameters(); if (($fieldSet = $parameters->getFieldSet($parentType)) === null) { return true; } return in_array($current->getRelationship()->getName(), $fieldSet, true) === true; }