AssemblerFactory::createService()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 12
Code Lines 6

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 6
nc 2
nop 1
1
<?php
2
3
namespace T4web\Mail;
4
5
use Zend\ServiceManager\FactoryInterface;
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
8
9 View Code Duplication
class AssemblerFactory implements FactoryInterface
0 ignored issues
show
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...
10
{
11
    public function createService(ServiceLocatorInterface $serviceLocator)
12
    {
13
        $config = $serviceLocator->get('config');
14
15
        if (!isset($config['t4web-mail']) || !is_array($config['t4web-mail'])) {
16
            throw new ServiceNotCreatedException('Can not create Mail\TemplateBuilder: config[t4web-mail] option not exists.');
17
        }
18
19
        return new Assembler(
20
            $config['t4web-mail']
21
        );
22
    }
23
}
24