]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blob - vendor/wikimedia/css-sanitizer/src/Objects/CSSObject.php
MediaWiki 1.30.2
[autoinstalls/mediawiki.git] / vendor / wikimedia / css-sanitizer / src / Objects / CSSObject.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 /**
10  * A base interface for "CSS objects"
11  *
12  * Each object has a position and an ability to be turned into a sequence of
13  * Tokens.
14  */
15 interface CSSObject {
16         /**
17          * Get the position of this object in the input stream
18          *
19          * Position is reported as one-based line and one-based codepoint within
20          * the line. If no position is available, returns -1 for both line and
21          * position.
22          *
23          * @return array [ $line, $pos ]
24          */
25         public function getPosition();
26
27         /**
28          * Return an array of Tokens that correspond to this object.
29          * @return Token[]
30          */
31         public function toTokenArray();
32
33         /**
34          * Return an array of ComponentValues that correspond to this object.
35          * @warning Do not return any Tokens that aren't valid in a ComponentValueList.
36          * @return ComponentValue[]
37          */
38         public function toComponentValueArray();
39 }