@@ -63,7 +63,7 @@ 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
- return static ::validateOptions ($ config );
66
+ return static ::validateOptions ($ config[ static :: CONFIG_MAIN_KEY ] );
67
67
}
68
68
69
69
/**
@@ -74,9 +74,9 @@ protected static function validateConfiguration(array $config)
74
74
*/
75
75
protected static function validateOptions (array $ config )
76
76
{
77
- foreach ($ config[ static :: CONFIG_MAIN_KEY ] as $ index => $ option ) {
77
+ foreach ($ config as $ option ) {
78
78
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 ' );
80
80
}
81
81
82
82
static ::validateMandatoryOptions ($ option );
@@ -85,7 +85,6 @@ protected static function validateOptions(array $config)
85
85
return true ;
86
86
}
87
87
88
-
89
88
/**
90
89
* @param array $config
91
90
*
@@ -96,37 +95,45 @@ protected static function validateMandatoryOptions(array $config)
96
95
{
97
96
foreach (static ::$ mandatoryOptions as $ option ) {
98
97
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 ;
100
108
}
101
109
}
102
- static ::validateInputOption ($ config );
103
- static ::validateOutputOption ($ config );
104
110
105
111
return true ;
106
112
}
113
+
107
114
/**
108
- * @param array $config
115
+ * @param array $option
109
116
*
110
117
* @return bool
111
118
*/
112
- protected static function validateInputOption ( array $ config )
119
+ protected static function validateIsArray ( $ option )
113
120
{
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! ' );
116
123
}
117
124
118
125
return true ;
119
126
}
120
127
121
128
/**
122
- * @param array $config
129
+ * @param string $option
123
130
*
124
131
* @return bool
125
132
*/
126
- protected static function validateOutputOption ( array $ config )
133
+ protected static function validateIsString ( $ option )
127
134
{
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! ' );
130
137
}
131
138
132
139
return true ;
0 commit comments