Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
53.85% covered (warning)
53.85%
7 / 13
CRAP
83.22% covered (warning)
83.22%
124 / 149
ActiveFormattingElements
0.00% covered (danger)
0.00%
0 / 1
53.85% covered (warning)
53.85%
7 / 13
82.13
83.11% covered (warning)
83.11%
123 / 148
 __destruct
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
5 / 5
 insertMarker
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
8 / 8
 push
0.00% covered (danger)
0.00%
0 / 1
7
95.00% covered (success)
95.00%
19 / 20
 clearToMarker
0.00% covered (danger)
0.00%
0 / 1
7.01
94.74% covered (success)
94.74%
18 / 19
 findElementByName
100.00% covered (success)
100.00%
1 / 1
4
100.00% covered (success)
100.00%
6 / 6
 isInList
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 remove
0.00% covered (danger)
0.00%
0 / 1
8.15
86.67% covered (warning)
86.67%
13 / 15
 addToNoahList
100.00% covered (success)
100.00%
1 / 1
3
100.00% covered (success)
100.00%
9 / 9
 removeFromNoahList
100.00% covered (success)
100.00%
1 / 1
5
100.00% covered (success)
100.00%
16 / 16
 replace
0.00% covered (danger)
0.00%
0 / 1
9.09
89.47% covered (warning)
89.47%
17 / 19
 insertAfter
0.00% covered (danger)
0.00%
0 / 1
6.44
76.92% covered (warning)
76.92%
10 / 13
 dump
0.00% covered (danger)
0.00%
0 / 1
56
0.00% covered (danger)
0.00%
0 / 16
 getTail
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
namespace Wikimedia\RemexHtml\TreeBuilder;
/**
 * The list of active formatting elements
 */
class ActiveFormattingElements {
    /** The last (most recent) element in the list */
    private $tail;
    /** The first (least recent) element in the list */
    private $head;
    /**
     * An array of arrays representing the population of elements in each bucket
     * according to the Noah's Ark clause. The outer array is stack-like, with each
     * integer-indexed element representing a segment of the list, bounded by
     * markers. The first element represents the segment of the list before the
     * first marker.
     *
     * The inner arrays are indexed by "Noah key", which is a string which uniquely
     * identifies each bucket according to the rules in the spec. The value in
     * the inner array is the first (least recently inserted) element in the bucket,
     * and subsequent members of the bucket can be found by iterating through the
     * singly-linked list via $node->nextNoah.
     *
     * This is optimised for the most common case of inserting into a bucket
     * with zero members, and deleting a bucket containing one member. In the
     * worst case, iteration through the list is still O(1) in the document
     * size, since each bucket can have at most 3 members.
     *
     * @var array<int,array<string,Element|Marker>>
     */
    private $noahTableStack = [ [] ];
    /**
     * Manually unlink the doubly-linked list, since otherwise, it is not freed
     * due to reference cycles.
     */
    public function __destruct() {
        for ( $node = $this->head; $node; $node = $next ) {