original_string: protected function addComponents(BaseGraph $graph, array $components, Node $parentNode = null)
      {
          // Sort the components
  //        uasort($components, function($component1, $component2) {
  //            $isNode1 = is_array($component1);
  //            $isNode2 = is_array($component2);
  //
  //            // If both are of the same type
  //            if ($isNode1 == $isNode2) {
  //                return 0;
  //
  //                // Else
  //            } else {
  //                return $isNode1 ? 1 : -1;
  //            }
  //        });
  
          // Run through all components
          foreach ($components as $name => $component) {
              // If this is a subnode
              if (is_array($component)) {
                  $this->addNode($graph, $name, $component, $parentNode);
  
                  // Else: Regular component
              } else {
                  $this->addComponent($graph, $component, $parentNode);
              }
          }
  
          return $graph;
      }
code: protected function addComponents(BaseGraph $graph, array $components, Node $parentNode = null)
      {
          // Sort the components
  //        uasort($components, function($component1, $component2) {
  //            $isNode1 = is_array($component1);
  //            $isNode2 = is_array($component2);
  //
  //            // If both are of the same type
  //            if ($isNode1 == $isNode2) {
  //                return 0;
  //
  //                // Else
  //            } else {
  //                return $isNode1 ? 1 : -1;
  //            }
  //        });
  
          // Run through all components
          foreach ($components as $name => $component) {
              // If this is a subnode
              if (is_array($component)) {
                  $this->addNode($graph, $name, $component, $parentNode);
  
                  // Else: Regular component
              } else {
                  $this->addComponent($graph, $component, $parentNode);
              }
          }
  
          return $graph;
      }
code_tokens: protected function addComponents ( BaseGraph $ graph , array $ components , Node $ parentNode = null ) { // Sort the components //        uasort($components, function($component1, $component2) { //            $isNode1 = is_array($component1); //            $isNode2 = is_array($component2); // //            // If both are of the same type //            if ($isNode1 == $isNode2) { //                return 0; // //                // Else //            } else { //                return $isNode1 ? 1 : -1; //            } //        }); // Run through all components foreach ( $ components as $ name => $ component ) { // If this is a subnode if ( is_array ( $ component ) ) { $ this -> addNode ( $ graph , $ name , $ component , $ parentNode ) ; // Else: Regular component } else { $ this -> addComponent ( $ graph , $ component , $ parentNode ) ; } } return $ graph ; }
docstring: Add a list of components to a graph
  
  @param BaseGraph $graph  Graph
  @param array $components Component list
  @param Node $parentNode  Parent node
  
  @return BaseGraph Graph
docstring_tokens: Add a list of components to a graph