@@ -63,33 +63,68 @@ protected static function validateConfiguration(array $config)
6363 throw new \InvalidArgumentException ('the extra.css-compiler setting must be an array of objects ' );
6464 }
6565
66- foreach ($ config [static ::CONFIG_MAIN_KEY ] as $ index => $ el ) {
67- if (!is_array ($ el )) {
66+ return static ::validateOptions ($ config );
67+ }
68+
69+ /**
70+ * @param array $config
71+ *
72+ * @return bool
73+ * @throws \InvalidArgumentException
74+ */
75+ protected static function validateOptions (array $ config )
76+ {
77+ foreach ($ config [static ::CONFIG_MAIN_KEY ] as $ index => $ option ) {
78+ if (!is_array ($ option )) {
6879 throw new \InvalidArgumentException ("the extra.css-compiler[ {$ index }]. " . static ::OPTION_KEY_INPUT . ' array ' );
6980 }
7081
71- static ::validateOptions ( $ el );
82+ static ::validateMandatoryOptions ( $ option );
7283 }
7384
7485 return true ;
7586 }
7687
88+
7789 /**
7890 * @param array $config
7991 *
8092 * @return bool
8193 * @throws \InvalidArgumentException
8294 */
83- protected static function validateOptions (array $ config )
95+ protected static function validateMandatoryOptions (array $ config )
8496 {
8597 foreach (static ::$ mandatoryOptions as $ option ) {
8698 if (empty ($ config [$ option ])) {
8799 throw new \InvalidArgumentException ("The extra.css-compiler[]. {$ option } required! " );
88100 }
89101 }
102+ static ::validateInputOption ($ config );
103+ static ::validateOutputOption ($ config );
104+
105+ return true ;
106+ }
107+ /**
108+ * @param array $config
109+ *
110+ * @return bool
111+ */
112+ protected static function validateInputOption (array $ config )
113+ {
90114 if (!is_array ($ config [static ::OPTION_KEY_INPUT ])) {
91115 throw new \InvalidArgumentException ('The extra.css-compiler[]. ' . static ::OPTION_KEY_INPUT . ' should be array! ' );
92116 }
117+
118+ return true ;
119+ }
120+
121+ /**
122+ * @param array $config
123+ *
124+ * @return bool
125+ */
126+ protected static function validateOutputOption (array $ config )
127+ {
93128 if (!is_string ($ config [static ::OPTION_KEY_OUTPUT ])) {
94129 throw new \InvalidArgumentException ('The extra.css-compiler[]. ' . static ::OPTION_KEY_OUTPUT . ' should string! ' );
95130 }
0 commit comments