public function _labelBlankNodes($namer, $element) {
    if(is_array($element)) {
      $length = count($element);
      for($i = 0; $i < $length; ++$i) {
        $element[$i] = $this->_labelBlankNodes($namer, $element[$i]);
      }
    } else if(self::_isList($element)) {
      $element->{'@list'} = $this->_labelBlankNodes(
        $namer, $element->{'@list'});
    } else if(is_object($element)) {
      // rename blank node
      if(self::_isBlankNode($element)) {
        $name = null;
        if(property_exists($element, '@id')) {
          $name = $element->{'@id'};
        }
        $element->{'@id'} = $namer->getName($name);
      }

      // recursively apply to all keys
      $keys = array_keys((array)$element);
      sort($keys);
      foreach($keys as $key) {
        if($key !== '@id') {
          $element->{$key} = $this->_labelBlankNodes($namer, $element->{$key});
        }
      }
    }

    return $element;
  }
public function _labelBlankNodes($namer, $element) {
    if(is_array($element)) {
      $length = count($element);
      for($i = 0; $i < $length; ++$i) {
        $element[$i] = $this->_labelBlankNodes($namer, $element[$i]);
      }
    } else if(self::_isList($element)) {
      $element->{'@list'} = $this->_labelBlankNodes(
        $namer, $element->{'@list'});
    } else if(is_object($element)) {
      // rename blank node
      if(self::_isBlankNode($element)) {
        $name = null;
        if(property_exists($element, '@id')) {
          $name = $element->{'@id'};
        }
        $element->{'@id'} = $namer->getName($name);
      }

      // recursively apply to all keys
      $keys = array_keys((array)$element);
      sort($keys);
      foreach($keys as $key) {
        if($key !== '@id') {
          $element->{$key} = $this->_labelBlankNodes($namer, $element->{$key});
        }
      }
    }

    return $element;
  }
public function _labelBlankNodes ( $ namer , $ element ) { if ( is_array ( $ element ) ) { $ length = count ( $ element ) ; for ( $ i = 0 ; $ i < $ length ; ++ $ i ) { $ element [ $ i ] = $ this -> _labelBlankNodes ( $ namer , $ element [ $ i ] ) ; } } else if ( self :: _isList ( $ element ) ) { $ element -> { '@list' } = $ this -> _labelBlankNodes ( $ namer , $ element -> { '@list' } ) ; } else if ( is_object ( $ element ) ) { // rename blank node if ( self :: _isBlankNode ( $ element ) ) { $ name = null ; if ( property_exists ( $ element , '@id' ) ) { $ name = $ element -> { '@id' } ; } $ element -> { '@id' } = $ namer -> getName ( $ name ) ; } // recursively apply to all keys $ keys = array_keys ( ( array ) $ element ) ; sort ( $ keys ) ; foreach ( $ keys as $ key ) { if ( $ key !== '@id' ) { $ element -> { $ key } = $ this -> _labelBlankNodes ( $ namer , $ element -> { $ key } ) ; } } } return $ element ; }
Labels the blank nodes in the given value using the given UniqueNamer.

@param UniqueNamer $namer the UniqueNamer to use.
@param mixed $element the element with blank nodes to rename.

@return mixed the element.
Labels the blank nodes in the given value using the given UniqueNamer .