| Conditions | 5 | 
| Paths | 4 | 
| Total Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 14 | 
| CRAP Score | 5 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 27 | 1665 | public static function collapseTextNodes(Node $container)  | 
            |
| 28 |     { | 
            ||
| 29 | 1665 | $walker = $container->walker();  | 
            |
| 30 | 1665 |         while (($event = $walker->next()) !== null) { | 
            |
| 31 | 1665 |             if ($event->isEntering()) { | 
            |
| 32 | 1665 | $node = $event->getNode();  | 
            |
| 33 | 1665 | $next = $node->next();  | 
            |
| 34 | 1665 |                 if ($node instanceof Text && $next instanceof Text) { | 
            |
| 35 | 390 | $node->append($next->getContent());  | 
            |
| 36 | 390 | $next->detach();  | 
            |
| 37 | // Re-start the next `while` iteration at the same spot as before  | 
            ||
| 38 | 390 | $walker->resumeAt($node, true);  | 
            |
| 39 | 130 | }  | 
            |
| 40 | 555 | }  | 
            |
| 41 | 555 | }  | 
            |
| 42 | 1665 | }  | 
            |
| 43 | }  | 
            ||
| 44 |