ReportManager::validatePlugin()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace ConferenceTools\Tickets\Report;
4
5
use Zend\ServiceManager\AbstractPluginManager;
6
use Zend\ServiceManager\Exception;
7
8
class ReportManager extends AbstractPluginManager
9
{
10
    /**
11
     * Validate the plugin
12
     *
13
     * Checks that the filter loaded is either a valid callback or an instance
14
     * of FilterInterface.
15
     *
16
     * @param  mixed $plugin
17
     * @return void
18
     * @throws Exception\RuntimeException if invalid
19
     */
20
    public function validatePlugin($plugin)
21
    {
22
        if ($plugin instanceof ReportInterface) {
23
            return;
24
        }
25
26
        throw new Exception\RuntimeException(
27
            sprintf('Report %s doesn\'t implement report interface', get_class($plugin))
28
        );
29
    }
30
31
}