File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public function addPlugin($class)
2424 }
2525
2626 $ plugin = is_object ($ class ) ? $ class : new $ class ($ this );
27- $ this ->plugins [] = $ plugin ;
27+ $ this ->plugins [get_class ( $ plugin ) ] = $ plugin ;
2828
2929 return $ plugin ;
3030 }
@@ -73,16 +73,15 @@ public function getClient()
7373
7474 public function getPlugin ($ class )
7575 {
76- foreach ($ this ->getPlugins () as $ plugin ) {
77- if (is_a ($ plugin , $ class )) {
78- return $ plugin ;
79- }
76+ if (!array_key_exists ($ class , $ this ->plugins )) {
77+ throw new Exception ("No plugin $ class " );
8078 }
79+ return $ this ->plugins [$ class ];
8180 }
8281
8382 public function getPlugins ()
8483 {
85- return $ this ->plugins ;
84+ return array_values ( $ this ->plugins ) ;
8685 }
8786
8887 public function getRepository ($ space )
You can’t perform that action at this time.
0 commit comments