Completed
Push — master ( 948998...4f0b2f )
by Jaap
13s
created

LogThrowableFactory::createService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Polder Knowledge / log-module (https://polderknowledge.com)
4
 *
5
 * @link https://github.com/polderknowledge/log-module for the canonical source repository
6
 * @copyright Copyright (c) 2016-2017 Polder Knowledge (https://polderknowledge.com)
7
 * @license https://github.com/polderknowledge/log-module/blob/master/LICENSE.md MIT
8
 */
9
10
namespace PolderKnowledge\LogModule\Controller\Plugin\Factory;
11
12
use Interop\Container\ContainerInterface;
13
use PolderKnowledge\LogModule\Controller\Plugin\LogThrowable;
14
use PolderKnowledge\LogModule\TaskService\ThrowableLogger;
15
use Zend\ServiceManager\FactoryInterface;
16
use Zend\ServiceManager\ServiceLocatorInterface;
17
18 View Code Duplication
final class LogThrowableFactory implements FactoryInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Zend\ServiceManager\FactoryInterface has been deprecated with message: Use Zend\ServiceManager\Factory\FactoryInterface instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20 4
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
21
    {
22
        /** @var ThrowableLogger $throwableLogger */
23 4
        $throwableLogger = $container->get(ThrowableLogger::class);
24
25 4
        return new LogThrowable($throwableLogger);
26
    }
27
28
    /**
29
     * Create service
30
     *
31
     * @param ServiceLocatorInterface $serviceLocator
32
     * @return mixed
33
     */
34 1
    public function createService(ServiceLocatorInterface $serviceLocator)
35
    {
36 1
        return $this($serviceLocator->getServiceLocator(), ThrowableLogger::class);
37
    }
38
}
39