Completed
Push — master ( 465bda...34cb64 )
by Alejandro
04:17
created

ErrorResponseGeneratorManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 12 3
1
<?php
2
namespace Acelaya\ExpressiveErrorHandler\ErrorHandler;
3
4
use Zend\ServiceManager\AbstractPluginManager;
5
use Zend\ServiceManager\Exception\InvalidServiceException;
6
7
class ErrorResponseGeneratorManager extends AbstractPluginManager implements ErrorResponseGeneratorManagerInterface
8
{
9 6
    public function validate($instance)
10
    {
11 6
        if (is_callable($instance)) {
12 6
            return;
13
        }
14
15 1
        throw new InvalidServiceException(sprintf(
16 1
            'Only callables are valid plugins for "%s". "%s" provided',
17 1
            __CLASS__,
18 1
            is_object($instance) ? get_class($instance) : gettype($instance)
19
        ));
20
    }
21
}
22