@@ -63,7 +63,7 @@ protected static function validateConfiguration(array $config)
6363 throw new \InvalidArgumentException ('the extra.css-compiler setting must be an array of objects ' );
6464 }
6565
66- return static ::validateOptions ($ config );
66+ return static ::validateOptions ($ config[ static :: CONFIG_MAIN_KEY ] );
6767 }
6868
6969 /**
@@ -74,9 +74,9 @@ protected static function validateConfiguration(array $config)
7474 */
7575 protected static function validateOptions (array $ config )
7676 {
77- foreach ($ config[ static :: CONFIG_MAIN_KEY ] as $ index => $ option ) {
77+ foreach ($ config as $ option ) {
7878 if (!is_array ($ option )) {
79- throw new \InvalidArgumentException (" the extra.css-compiler[ { $ index } ]. " . static ::OPTION_KEY_INPUT . ' array ' );
79+ throw new \InvalidArgumentException (' extra. ' . static :: CONFIG_MAIN_KEY . " [ ]. " . static ::OPTION_KEY_INPUT . ' array ' );
8080 }
8181
8282 static ::validateMandatoryOptions ($ option );
@@ -85,7 +85,6 @@ protected static function validateOptions(array $config)
8585 return true ;
8686 }
8787
88-
8988 /**
9089 * @param array $config
9190 *
@@ -96,37 +95,45 @@ protected static function validateMandatoryOptions(array $config)
9695 {
9796 foreach (static ::$ mandatoryOptions as $ option ) {
9897 if (empty ($ config [$ option ])) {
99- throw new \InvalidArgumentException ("The extra.css-compiler[]. {$ option } required! " );
98+ throw new \InvalidArgumentException ('extra. ' . static ::CONFIG_MAIN_KEY . "[]. {$ option } is required! " );
99+ }
100+
101+ switch ($ option ) {
102+ case static ::OPTION_KEY_INPUT :
103+ static ::validateIsArray ($ config [$ option ]);
104+ break ;
105+ case static ::OPTION_KEY_OUTPUT :
106+ static ::validateIsString ($ config [$ option ]);
107+ break ;
100108 }
101109 }
102- static ::validateInputOption ($ config );
103- static ::validateOutputOption ($ config );
104110
105111 return true ;
106112 }
113+
107114 /**
108- * @param array $config
115+ * @param array $option
109116 *
110117 * @return bool
111118 */
112- protected static function validateInputOption ( array $ config )
119+ protected static function validateIsArray ( $ option )
113120 {
114- if (!is_array ($ config [ static :: OPTION_KEY_INPUT ] )) {
115- throw new \InvalidArgumentException ('The extra.css-compiler[]. ' . static ::OPTION_KEY_INPUT . ' should be array! ' );
121+ if (!is_array ($ option )) {
122+ throw new \InvalidArgumentException ('extra. ' . static :: CONFIG_MAIN_KEY . ' [] ' . static ::OPTION_KEY_INPUT . ' should be array! ' );
116123 }
117124
118125 return true ;
119126 }
120127
121128 /**
122- * @param array $config
129+ * @param string $option
123130 *
124131 * @return bool
125132 */
126- protected static function validateOutputOption ( array $ config )
133+ protected static function validateIsString ( $ option )
127134 {
128- if (!is_string ($ config [ static :: OPTION_KEY_OUTPUT ] )) {
129- throw new \InvalidArgumentException ('The extra.css-compiler[]. ' . static ::OPTION_KEY_OUTPUT . ' should string! ' );
135+ if (!is_string ($ option )) {
136+ throw new \InvalidArgumentException ('extra. ' . static :: CONFIG_MAIN_KEY . ' [] ' . static ::OPTION_KEY_OUTPUT . ' should string! ' );
130137 }
131138
132139 return true ;
0 commit comments