@@ -63,33 +63,68 @@ protected static function validateConfiguration(array $config)
63
63
throw new \InvalidArgumentException ('the extra.css-compiler setting must be an array of objects ' );
64
64
}
65
65
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 )) {
68
79
throw new \InvalidArgumentException ("the extra.css-compiler[ {$ index }]. " . static ::OPTION_KEY_INPUT . ' array ' );
69
80
}
70
81
71
- static ::validateOptions ( $ el );
82
+ static ::validateMandatoryOptions ( $ option );
72
83
}
73
84
74
85
return true ;
75
86
}
76
87
88
+
77
89
/**
78
90
* @param array $config
79
91
*
80
92
* @return bool
81
93
* @throws \InvalidArgumentException
82
94
*/
83
- protected static function validateOptions (array $ config )
95
+ protected static function validateMandatoryOptions (array $ config )
84
96
{
85
97
foreach (static ::$ mandatoryOptions as $ option ) {
86
98
if (empty ($ config [$ option ])) {
87
99
throw new \InvalidArgumentException ("The extra.css-compiler[]. {$ option } required! " );
88
100
}
89
101
}
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
+ {
90
114
if (!is_array ($ config [static ::OPTION_KEY_INPUT ])) {
91
115
throw new \InvalidArgumentException ('The extra.css-compiler[]. ' . static ::OPTION_KEY_INPUT . ' should be array! ' );
92
116
}
117
+
118
+ return true ;
119
+ }
120
+
121
+ /**
122
+ * @param array $config
123
+ *
124
+ * @return bool
125
+ */
126
+ protected static function validateOutputOption (array $ config )
127
+ {
93
128
if (!is_string ($ config [static ::OPTION_KEY_OUTPUT ])) {
94
129
throw new \InvalidArgumentException ('The extra.css-compiler[]. ' . static ::OPTION_KEY_OUTPUT . ' should string! ' );
95
130
}
0 commit comments