]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - vendor/wikimedia/css-sanitizer/src/Objects/Rule.php
MediaWiki 1.30.2-scripts2
[autoinstalls/mediawiki.git] / vendor / wikimedia / css-sanitizer / src / Objects / Rule.php
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 use Wikimedia\CSS\Util;
10
11 /**
12  * Represent an abstract CSS rule
13  */
14 abstract class Rule implements CSSObject {
15
16         /** @var int Line and position in the input where this rule starts */
17         protected $line = -1, $pos = -1;
18
19         /**
20          * @param Token $token Token starting the rule
21          */
22         public function __construct( Token $token ) {
23                 list( $this->line, $this->pos ) = $token->getPosition();
24         }
25
26         /**
27          * Get the position of this Declaration in the input stream
28          * @return array [ $line, $pos ]
29          */
30         public function getPosition() {
31                 return [ $this->line, $this->pos ];
32         }
33 }