@@ 9-34 (lines=26) @@ | ||
6 | use Zend\ServiceManager\AbstractPluginManager; |
|
7 | use Zend\ServiceManager\Exception\RuntimeException; |
|
8 | ||
9 | class EventManagerPluginManager extends AbstractPluginManager |
|
10 | { |
|
11 | /** |
|
12 | * Validate the plugin |
|
13 | * |
|
14 | * Checks that the filter loaded is either a valid callback or an instance |
|
15 | * of FilterInterface. |
|
16 | * |
|
17 | * @param mixed $plugin |
|
18 | * @return void |
|
19 | * @throws RuntimeException if invalid |
|
20 | */ |
|
21 | public function validatePlugin($plugin) |
|
22 | { |
|
23 | if ($plugin instanceof EventManagerInterface) { |
|
24 | // we're ok. |
|
25 | return; |
|
26 | } |
|
27 | ||
28 | throw new RuntimeException(sprintf( |
|
29 | 'Plugin of type %s is invalid; must implement %s', |
|
30 | (is_object($plugin) ? get_class($plugin) : gettype($plugin)), |
|
31 | '\Zend\EventManager\EventManagerInterface' |
|
32 | )); |
|
33 | } |
|
34 | } |
|
35 |
@@ 9-34 (lines=26) @@ | ||
6 | use Zend\ServiceManager\AbstractPluginManager; |
|
7 | use Zend\ServiceManager\Exception\RuntimeException; |
|
8 | ||
9 | class ListenerAggregatePluginManager extends AbstractPluginManager |
|
10 | { |
|
11 | /** |
|
12 | * Validate the plugin |
|
13 | * |
|
14 | * Checks that the filter loaded is either a valid callback or an instance |
|
15 | * of FilterInterface. |
|
16 | * |
|
17 | * @param mixed $plugin |
|
18 | * @return void |
|
19 | * @throws RuntimeException if invalid |
|
20 | */ |
|
21 | public function validatePlugin($plugin) |
|
22 | { |
|
23 | if ($plugin instanceof ListenerAggregateInterface) { |
|
24 | // we're ok. |
|
25 | return; |
|
26 | } |
|
27 | ||
28 | throw new RuntimeException(sprintf( |
|
29 | 'Plugin of type %s is invalid; must implement %s', |
|
30 | (is_object($plugin) ? get_class($plugin) : gettype($plugin)), |
|
31 | '\Zend\EventManager\ListenerAggregateInterface' |
|
32 | )); |
|
33 | } |
|
34 | } |
|
35 |