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

ErrorResponseGeneratorManager::validate()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 3

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 7
cts 7
cp 1
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 2
nop 1
crap 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