src/Entity.php
private function getDataReference($item) {
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ((is_a($item, '\Nymph\Entity') || is_a($item, '\SciActive\HookOverride'))
        && is_callable([$item, 'toReference'])) {
      // Convert entities to references.
      return $item->toReference();
    } elseif (is_array($item)) {
      // Recurse into lower arrays.
      return array_map([$this, 'getDataReference'], $item);
    } elseif (is_object($item)) {
      foreach ($item as &$curProperty) {
        $curProperty = $this->getDataReference($curProperty);
      }
      unset($curProperty);
    }
    // Not an entity or array, just return it.
    return $item;
  }
private function getDataReference($item) {
    if ($this->isASleepingReference) {
      $this->referenceWake();
    }
    if ((is_a($item, '\Nymph\Entity') || is_a($item, '\SciActive\HookOverride'))
        && is_callable([$item, 'toReference'])) {
      // Convert entities to references.
      return $item->toReference();
    } elseif (is_array($item)) {
      // Recurse into lower arrays.
      return array_map([$this, 'getDataReference'], $item);
    } elseif (is_object($item)) {
      foreach ($item as &$curProperty) {
        $curProperty = $this->getDataReference($curProperty);
      }
      unset($curProperty);
    }
    // Not an entity or array, just return it.
    return $item;
  }
private function getDataReference ( $ item ) { if ( $ this -> isASleepingReference ) { $ this -> referenceWake ( ) ; } if ( ( is_a ( $ item , '\Nymph\Entity' ) || is_a ( $ item , '\SciActive\HookOverride' ) ) && is_callable ( [ $ item , 'toReference' ] ) ) { // Convert entities to references. return $ item -> toReference ( ) ; } elseif ( is_array ( $ item ) ) { // Recurse into lower arrays. return array_map ( [ $ this , 'getDataReference' ] , $ item ) ; } elseif ( is_object ( $ item ) ) { foreach ( $ item as & $ curProperty ) { $ curProperty = $ this -> getDataReference ( $ curProperty ) ; } unset ( $ curProperty ) ; } // Not an entity or array, just return it. return $ item ; }
Convert entities to references and return the result.

@param mixed $item The item to convert.
@return mixed The resulting item.
Convert entities to references and return the result .