Completed
Push — master ( 5f7cbd...b12d8e )
by Alejandro
03:03
created

ErrorHandlerManager::validate()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
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 ErrorHandlerManager extends AbstractPluginManager implements ErrorHandlerManagerInterface
8
{
9 5
    public function validate($instance)
10
    {
11 5
        if (is_callable($instance)) {
12 5
            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 1
        ));
20
    }
21
}
22