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