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