@@ -59,9 +59,9 @@ class Installer extends RepositoryAware
59
59
/**
60
60
* Hook that should be handled.
61
61
*
62
- * @var string
62
+ * @var array
63
63
*/
64
- protected $ hookToHandle ;
64
+ protected $ hooksToHandle ;
65
65
66
66
/**
67
67
* Hook template
@@ -138,10 +138,23 @@ public function setMoveExistingTo(string $backup): Installer
138
138
*/
139
139
public function setHook (string $ hook ): Installer
140
140
{
141
- if (!empty ($ hook ) && !HookUtil::isInstallable ($ hook )) {
142
- throw new Exception \InvalidHookName ('Invalid hook name \'' . $ hook . '\'' );
141
+ if (!empty ($ hook )) {
142
+ $ hooks = explode (', ' , $ hook );
143
+ if ($ hooks === false ) {
144
+ throw new Exception \InvalidHookName ('Invalid hook name \'' . $ hook . '\'' );
145
+ }
146
+ $ hooksValidationCallback = static function (string $ hook ): bool {
147
+ return !HookUtil::isInstallable ($ hook );
148
+ };
149
+ if (!empty (($ invalidHooks = array_filter ($ hooks , $ hooksValidationCallback )))) {
150
+ throw new Exception \InvalidHookName (
151
+ 'Invalid hook name \'' . implode (', ' , $ invalidHooks ) . '\''
152
+ );
153
+ }
154
+
155
+ $ this ->hooksToHandle = $ hooks ;
143
156
}
144
- $ this -> hookToHandle = $ hook ;
157
+
145
158
return $ this ;
146
159
}
147
160
@@ -178,9 +191,9 @@ public function getHooksToInstall(): array
178
191
return true ;
179
192
};
180
193
// if a specific hook is set, the use has actively chosen it, so don't ask for permission anymore
181
- return empty ($ this ->hookToHandle )
194
+ return empty ($ this ->hooksToHandle )
182
195
? array_map ($ callback , Hooks::nativeHooks ())
183
- : [ $ this ->hookToHandle => false ] ;
196
+ : array_map ( static function (): bool { return false ; }, array_flip ( $ this ->hooksToHandle )) ;
184
197
}
185
198
186
199
/**
0 commit comments