function _createsCircularReference($subject_to_embed, $subject_stack) {
    for($i = count($subject_stack) - 1; $i >= 0; --$i) {
      if($subject_stack[$i]->{'@id'} === $subject_to_embed->{'@id'}) {
        return true;
      }
    }
    return false;
  }
function _createsCircularReference($subject_to_embed, $subject_stack) {
    for($i = count($subject_stack) - 1; $i >= 0; --$i) {
      if($subject_stack[$i]->{'@id'} === $subject_to_embed->{'@id'}) {
        return true;
      }
    }
    return false;
  }
function _createsCircularReference ( $ subject_to_embed , $ subject_stack ) { for ( $ i = count ( $ subject_stack ) - 1 ; $ i >= 0 ; -- $ i ) { if ( $ subject_stack [ $ i ] -> { '@id' } === $ subject_to_embed -> { '@id' } ) { return true ; } } return false ; }
Checks the current subject stack to see if embedding the given subject
would cause a circular reference.

@param stdClass subject_to_embed the subject to embed.
@param assoc subject_stack the current stack of subjects.

@return bool true if a circular reference would be created, false if not.
Checks the current subject stack to see if embedding the given subject would cause a circular reference .