Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Rule | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPosition | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare( strict_types = 1 ); |
| 3 | |
| 4 | /** |
| 5 | * @file |
| 6 | * @license https://opensource.org/licenses/Apache-2.0 Apache-2.0 |
| 7 | */ |
| 8 | |
| 9 | namespace Wikimedia\CSS\Objects; |
| 10 | |
| 11 | /** |
| 12 | * Represent an abstract CSS rule |
| 13 | */ |
| 14 | abstract class Rule implements CSSObject { |
| 15 | |
| 16 | /** @var int Line in the input where this rule starts */ |
| 17 | protected $line = -1; |
| 18 | |
| 19 | /** @var int Position in the input where this rule starts */ |
| 20 | protected $pos = -1; |
| 21 | |
| 22 | /** |
| 23 | * @param Token $token Token starting the rule |
| 24 | */ |
| 25 | public function __construct( Token $token ) { |
| 26 | [ $this->line, $this->pos ] = $token->getPosition(); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get the position of this Declaration in the input stream |
| 31 | * @return array [ $line, $pos ] |
| 32 | */ |
| 33 | public function getPosition() { |
| 34 | return [ $this->line, $this->pos ]; |
| 35 | } |
| 36 | } |