@@ -11,20 +11,20 @@ class WorkflowLoaderRegistry
11
11
public function __construct (array $ loaders )
12
12
{
13
13
foreach ($ loaders as $ key => $ loader ) {
14
- if (!isset ($ loader ['class ' ])) {
14
+ if (! isset ($ loader ['class ' ])) {
15
15
throw new \Exception ("Key 'class' configuration not found in {$ key } loader " );
16
16
}
17
17
18
- if (!class_exists ($ loader ['class ' ])) {
18
+ if (! class_exists ($ loader ['class ' ])) {
19
19
throw new \Exception ("Class {$ loader ['class ' ]} not found " );
20
20
}
21
- $ this ->registerLoader ($ key , $ loader -> class );
21
+ $ this ->registerLoader ($ key , app ()-> make ( $ loader [ ' class ' ]) );
22
22
}
23
23
}
24
24
25
25
public function registerLoader (string $ name , WorkflowLoaderContract $ loader )
26
26
{
27
- $ this ->loaders [$ name ] = app ()-> make ( $ loader) ;
27
+ $ this ->loaders [$ name ] = $ loader ;
28
28
}
29
29
30
30
public function getLoaders (): array
@@ -34,10 +34,10 @@ public function getLoaders(): array
34
34
35
35
public function getLoader (string $ name ): WorkflowLoaderContract
36
36
{
37
- if (!isset ($ this ->loaders [$ name ])) {
37
+ if (! isset ($ this ->loaders [$ name ])) {
38
38
throw new \Exception ("Loader {$ name } not found " );
39
39
}
40
-
40
+
41
41
return $ this ->loaders [$ name ];
42
42
}
43
43
@@ -47,11 +47,13 @@ public function all(): array
47
47
return [];
48
48
}
49
49
50
- $ workflows = collect ([]) ;
50
+ $ workflows = [] ;
51
51
foreach ($ this ->loaders as $ name => $ loader ) {
52
- $ workflows = $ workflows ->merge (collect ($ loader ->all ()));
52
+ foreach ($ loader ->all () as $ workflow => $ config ) {
53
+ $ workflows [$ workflow ] = $ config ;
54
+ }
53
55
}
54
56
55
- return $ workflows-> toArray () ;
57
+ return $ workflows ;
56
58
}
57
59
}
0 commit comments