]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - vendor/wikimedia/css-sanitizer/src/Objects/ComponentValueList.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / wikimedia / css-sanitizer / src / Objects / ComponentValueList.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  * Represent a list of CSS declarations
11  */
12 class ComponentValueList extends CSSObjectList {
13         protected static $objectType = ComponentValue::class;
14
15         protected static function testObjects( array $objects ) {
16                 foreach ( $objects as $object ) {
17                         $type = $object instanceof Token ? $object->type() : 'n/a';
18                         switch ( $type ) {
19                                 case Token::T_FUNCTION:
20                                 case Token::T_LEFT_BRACKET:
21                                 case Token::T_LEFT_PAREN:
22                                 case Token::T_LEFT_BRACE:
23                                         throw new \InvalidArgumentException(
24                                                 static::class . " may not contain tokens of type \"$type\"."
25                                         );
26                         }
27                 }
28         }
29
30         // Much simpler
31         public function toComponentValueArray() {
32                 return $this->objects;
33         }
34 }