spawn() публичный Метод

Create a new instance of the same class with $this as the parent. This is used for the chaining.
public spawn ( array | Traversable | DOMNode | Nodes $elements = NULL ) : Nodes
$elements array | Traversable | DOMNode | Nodes
Результат Nodes
Пример #1
0
 public function groupByCallable(Nodes $nodes, callable $fn)
 {
     $grouping = [];
     foreach ($nodes as $node) {
         $key = $fn($node);
         if (!isset($grouping[$key])) {
             $grouping[$key] = [];
         }
         $grouping[$key][] = $node;
     }
     foreach ($grouping as $key => &$nodeList) {
         $nodeList = $nodes->spawn($nodeList);
     }
     return $grouping;
 }