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

ErrorHandlerManager   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 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 15
ccs 8
cts 8
cp 1
rs 10

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 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