src/Entity.php
private function entityToReference(&$item, $key) {
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ((is_a($item, '\Nymph\Entity') || is_a($item, '\SciActive\HookOverride'))
        && isset($item->guid) && is_callable([$item, 'toReference'])) {
      // This is an entity, so we should put it in the entity cache.
      if (!isset($this->entityCache["referenceGuid__{$item->guid}"])) {
        $this->entityCache["referenceGuid__{$item->guid}"] = clone $item;
      }
      // Make a reference to the entity (its GUID and the class the entity was
      // loaded as).
      $item = $item->toReference();
    }
  }
private function entityToReference(&$item, $key) {
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ((is_a($item, '\Nymph\Entity') || is_a($item, '\SciActive\HookOverride'))
        && isset($item->guid) && is_callable([$item, 'toReference'])) {
      // This is an entity, so we should put it in the entity cache.
      if (!isset($this->entityCache["referenceGuid__{$item->guid}"])) {
        $this->entityCache["referenceGuid__{$item->guid}"] = clone $item;
      }
      // Make a reference to the entity (its GUID and the class the entity was
      // loaded as).
      $item = $item->toReference();
    }
  }
private function entityToReference ( & $ item , $ key ) { if ( $ this -> isASleepingReference ) { $ this -> referenceWake ( ) ; } if ( ( is_a ( $ item , '\Nymph\Entity' ) || is_a ( $ item , '\SciActive\HookOverride' ) ) && isset ( $ item -> guid ) && is_callable ( [ $ item , 'toReference' ] ) ) { // This is an entity, so we should put it in the entity cache. if ( ! isset ( $ this -> entityCache [ "referenceGuid__{$item->guid}" ] ) ) { $ this -> entityCache [ "referenceGuid__{$item->guid}" ] = clone $ item ; } // Make a reference to the entity (its GUID and the class the entity was // loaded as). $ item = $ item -> toReference ( ) ; } }
Check if an item is an entity, and if it is, convert it to a reference.

@param mixed &$item The item to check.
@param mixed $key Unused, but can't be removed because array_walk_recursive
will fail.
@access private
Check if an item is an entity and if it is convert it to a reference .