MediaConverterFactory::createService()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6
Metric Value
dl 0
loc 17
ccs 0
cts 8
cp 0
rs 9.4285
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
3
namespace Soluble\Media\Converter\Service;
4
5
use Soluble\Media\Converter;
6
use Zend\ServiceManager\FactoryInterface;
7
use Zend\ServiceManager\ServiceLocatorInterface;
8
9
class MediaConverterFactory implements FactoryInterface
0 ignored issues
show
Bug introduced by
There is one abstract method __invoke in this class; you could implement it, or declare this class as abstract.
Loading history...
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...
10
{
11
    /**
12
     *
13
     * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
14
     * @return \Soluble\Media\Converter
15
     */
16
    public function createService(ServiceLocatorInterface $serviceLocator)
17
    {
18
19
        /*
20
        $config = $serviceLocator->get('Config');
21
        $config = isset($config['Soluble\Normalist']) ? $config['Soluble\Normalist'] : array();
22
        if (empty($config)) {
23
            throw new \Exception("Cannot locate Soluble\Normalist configuration, please review your configuration.");
24
        }
25
        */
26
27
        $converter = new Converter();
28
        if ($serviceLocator->has('Cache\SolubleMediaConverter')) {
29
            $converter->setCache($serviceLocator->get('Cache\SolubleMediaConverter'));
30
        }
31
        return $converter;
32
    }
33
}
34