original_string: protected function convertNodes(Array $nodes, $em) {
      // our test project (this) is defined to have only de as i18n but dont get confused, these are english wordings
      $navigationNodes = array();
  
      foreach ($nodes as $node) {
        $node = (object) $node;
        $navigationNode = $this->createNode(array('de'=>$node->title));
        $navigationNode->setContext($this->context);
        $navigationNode->generateSlugs();
  
        $page = $this->createPage($navigationNode->getSlug('de'));
        $page->setActive(TRUE);
        $em->persist($page);
  
        $navigationNode->setPage($page);
  
        $navigationNodes[$navigationNode->getTitle('de')] = $navigationNode;
      }
  
      foreach ($nodes as $node) {
        $node = (object) $node;
  
        if (isset($node->parent)) {
          $navigationNodes[$node->title]->setParent($navigationNodes[$node->parent]);
        }
      }
  
      return $navigationNodes;
    }
code: protected function convertNodes(Array $nodes, $em) {
      // our test project (this) is defined to have only de as i18n but dont get confused, these are english wordings
      $navigationNodes = array();
  
      foreach ($nodes as $node) {
        $node = (object) $node;
        $navigationNode = $this->createNode(array('de'=>$node->title));
        $navigationNode->setContext($this->context);
        $navigationNode->generateSlugs();
  
        $page = $this->createPage($navigationNode->getSlug('de'));
        $page->setActive(TRUE);
        $em->persist($page);
  
        $navigationNode->setPage($page);
  
        $navigationNodes[$navigationNode->getTitle('de')] = $navigationNode;
      }
  
      foreach ($nodes as $node) {
        $node = (object) $node;
  
        if (isset($node->parent)) {
          $navigationNodes[$node->title]->setParent($navigationNodes[$node->parent]);
        }
      }
  
      return $navigationNodes;
    }
code_tokens: protected function convertNodes ( Array $ nodes , $ em ) { // our test project (this) is defined to have only de as i18n but dont get confused, these are english wordings $ navigationNodes = array ( ) ; foreach ( $ nodes as $ node ) { $ node = ( object ) $ node ; $ navigationNode = $ this -> createNode ( array ( 'de' => $ node -> title ) ) ; $ navigationNode -> setContext ( $ this -> context ) ; $ navigationNode -> generateSlugs ( ) ; $ page = $ this -> createPage ( $ navigationNode -> getSlug ( 'de' ) ) ; $ page -> setActive ( TRUE ) ; $ em -> persist ( $ page ) ; $ navigationNode -> setPage ( $ page ) ; $ navigationNodes [ $ navigationNode -> getTitle ( 'de' ) ] = $ navigationNode ; } foreach ( $ nodes as $ node ) { $ node = ( object ) $ node ; if ( isset ( $ node -> parent ) ) { $ navigationNodes [ $ node -> title ] -> setParent ( $ navigationNodes [ $ node -> parent ] ) ; } } return $ navigationNodes ; }
docstring: we elevate every node to an entity and set parent pointers
docstring_tokens: we elevate every node to an entity and set parent pointers