File tree Expand file tree Collapse file tree 2 files changed +16
-26
lines changed Expand file tree Collapse file tree 2 files changed +16
-26
lines changed Original file line number Diff line number Diff line change @@ -485,19 +485,20 @@ private function parseNumericValue($bForColor = false) {
485
485
486
486
private function parseLineNameValue () {
487
487
$ this ->consume ('[ ' );
488
- $ sName = '' ;
489
- try {
490
- do {
491
- $ this ->consumeWhiteSpace ();
492
- $ sName .= $ this -> parseIdentifier ( false , true ) . ' ' ;
493
- } while (! $ this ->comes ( ' ] ' ) );
494
- } catch (UnexpectedTokenException $ e ) {
495
- if (! $ this -> oParserSettings -> bLenientParsing && (! $ sName || ! $ this -> comes ( ' ] ' ))) { // This handles constructs like this [ linename ] in non lenient mode
496
- throw $ e ;
488
+ $ this -> consumeWhiteSpace () ;
489
+ $ aNames = array ();
490
+ do {
491
+ if ( $ this ->oParserSettings -> bLenientParsing ) {
492
+ try {
493
+ $ aNames [] = $ this ->parseIdentifier ( false , true );
494
+ } catch (UnexpectedTokenException $ e ) {}
495
+ } else {
496
+ $ aNames [] = $ this -> parseIdentifier ( false , true ) ;
497
497
}
498
- }
498
+ $ this ->consumeWhiteSpace ();
499
+ } while (!$ this ->comes ('] ' ));
499
500
$ this ->consume ('] ' );
500
- return new LineName (rtrim ( $ sName ) , $ this ->iLineNo );
501
+ return new LineName ($ aNames , $ this ->iLineNo );
501
502
}
502
503
503
504
private function parseColorValue () {
Original file line number Diff line number Diff line change 2
2
3
3
namespace Sabberworm \CSS \Value ;
4
4
5
- class LineName extends PrimitiveValue {
6
- private $ sName ;
7
-
8
- public function __construct ($ sName , $ iLineNo = 0 ) {
9
- parent ::__construct ($ iLineNo );
10
- $ this ->sName = $ sName ;
11
- }
12
-
13
- public function setName ($ sName ) {
14
- $ this ->sName = $ sName ;
15
- }
16
-
17
- public function getName () {
18
- return $ this ->sName ;
5
+ class LineName extends ValueList {
6
+ public function __construct ($ aComponents = array (), $ iLineNo = 0 ) {
7
+ parent ::__construct ($ aComponents , ' ' , $ iLineNo );
19
8
}
20
9
21
10
public function __toString () {
22
11
return $ this ->render (new \Sabberworm \CSS \OutputFormat ());
23
12
}
24
13
25
14
public function render (\Sabberworm \CSS \OutputFormat $ oOutputFormat ) {
26
- return " [ { $ this -> sName } ] " ;
15
+ return ' [ ' . parent :: render (\ Sabberworm \ CSS \OutputFormat:: createCompact ()) . ' ] ' ;
27
16
}
28
17
29
18
}
You can’t perform that action at this time.
0 commit comments