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
ComponentValue
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
 getPosition
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toComponentValueArray
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2declare( strict_types = 1 );
3
4/**
5 * @file
6 * @license https://opensource.org/licenses/Apache-2.0 Apache-2.0
7 */
8
9namespace Wikimedia\CSS\Objects;
10
11/**
12 * Represent a CSS component value, eg. `html`, `div`, `10px`, `20px` are all
13 * component values in the rule `html div { margin: 10px 20px; }`.
14 */
15abstract class ComponentValue implements CSSObject {
16
17    /** @var int Line in the input where this component value starts */
18    protected $line = -1;
19
20    /** @var int Position in the input where this component value starts */
21    protected $pos = -1;
22
23    /**
24     * Get the position of this ComponentValue in the input stream
25     * @return array [ $line, $pos ]
26     */
27    public function getPosition() {
28        return [ $this->line, $this->pos ];
29    }
30
31    /** @inheritDoc */
32    public function toComponentValueArray() {
33        return [ $this ];
34    }
35}