Debian Codegraph @

vendor/wikimedia/css-sanitizer/src/Objects/Rule.php

raw
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 an abstract CSS rule
11 */
12 abstract 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 }