33namespace Sabberworm \CSS ;
44
55use Sabberworm \CSS \Parsing \OutputException ;
6+ use Sabberworm \CSS \OutputFormatter ;
67
78/**
89 * Class OutputFormat
@@ -81,7 +82,7 @@ public function __construct()
8182
8283 public function get ($ sName )
8384 {
84- $ aVarPrefixes = array ( 'a ' , 's ' , 'm ' , 'b ' , 'f ' , 'o ' , 'c ' , 'i ' ) ;
85+ $ aVarPrefixes = [ 'a ' , 's ' , 'm ' , 'b ' , 'f ' , 'o ' , 'c ' , 'i ' ] ;
8586 foreach ($ aVarPrefixes as $ sPrefix ) {
8687 $ sFieldName = $ sPrefix . ucfirst ($ sName );
8788 if (isset ($ this ->$ sFieldName )) {
@@ -93,11 +94,11 @@ public function get($sName)
9394
9495 public function set ($ aNames , $ mValue )
9596 {
96- $ aVarPrefixes = array ( 'a ' , 's ' , 'm ' , 'b ' , 'f ' , 'o ' , 'c ' , 'i ' ) ;
97+ $ aVarPrefixes = [ 'a ' , 's ' , 'm ' , 'b ' , 'f ' , 'o ' , 'c ' , 'i ' ] ;
9798 if (is_string ($ aNames ) && strpos ($ aNames , '* ' ) !== false ) {
98- $ aNames = array ( str_replace ('* ' , 'Before ' , $ aNames ), str_replace ('* ' , 'Between ' , $ aNames ), str_replace ('* ' , 'After ' , $ aNames )) ;
99+ $ aNames = [ str_replace ('* ' , 'Before ' , $ aNames ), str_replace ('* ' , 'Between ' , $ aNames ), str_replace ('* ' , 'After ' , $ aNames )] ;
99100 } elseif (!is_array ($ aNames )) {
100- $ aNames = array ( $ aNames) ;
101+ $ aNames = [ $ aNames] ;
101102 }
102103 foreach ($ aVarPrefixes as $ sPrefix ) {
103104 $ bDidReplace = false ;
@@ -122,8 +123,8 @@ public function __call($sMethodName, $aArguments)
122123 return $ this ->set (substr ($ sMethodName , 3 ), $ aArguments [0 ]);
123124 } elseif (strpos ($ sMethodName , 'get ' ) === 0 ) {
124125 return $ this ->get (substr ($ sMethodName , 3 ));
125- } elseif (method_exists ('\\ Sabberworm \\ CSS \\ OutputFormatter ' , $ sMethodName )) {
126- return call_user_func_array (array ( $ this ->getFormatter (), $ sMethodName) , $ aArguments );
126+ } elseif (method_exists (OutputFormatter::class , $ sMethodName )) {
127+ return call_user_func_array ([ $ this ->getFormatter (), $ sMethodName] , $ aArguments );
127128 } else {
128129 throw new \Exception ('Unknown OutputFormat method called: ' . $ sMethodName );
129130 }
@@ -197,7 +198,7 @@ public static function createCompact()
197198 public static function createPretty ()
198199 {
199200 $ format = self ::create ();
200- $ format ->set ('Space*Rules ' , "\n" )->set ('Space*Blocks ' , "\n" )->setSpaceBetweenBlocks ("\n\n" )->set ('SpaceAfterListArgumentSeparator ' , array ( 'default ' => '' , ', ' => ' ' ) );
201+ $ format ->set ('Space*Rules ' , "\n" )->set ('Space*Blocks ' , "\n" )->setSpaceBetweenBlocks ("\n\n" )->set ('SpaceAfterListArgumentSeparator ' , [ 'default ' => '' , ', ' => ' ' ] );
201202 return $ format ;
202203 }
203204}
0 commit comments