Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
5 / 5
CRAP
100.00% covered (success)
100.00%
9 / 9
SingleLineContext
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
5 / 5
6
100.00% covered (success)
100.00%
9 / 9
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 enforce
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 enforced
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 disable
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 pop
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
<?php
declare( strict_types = 1 );
namespace Wikimedia\Parsoid\Html2Wt;
/**
 * Stack and helpers to enforce single-line context while serializing.
 */
class SingleLineContext {
    // PORT-TODO document
    /** @var array */
    private $stack;
    public function __construct() {
        $this->stack = [];
    }
    public function enforce(): void {
        $this->stack[] = true;
    }
    public function enforced(): bool {
        return count( $this->stack ) > 0 && end( $this->stack );
    }
    public function disable(): void {
        $this->stack[] = false;
    }
    public function pop(): void {
        array_pop( $this->stack );
    }
}