Code Duplication    Length = 15-16 lines in 2 locations

src/AssemblerFactory.php 1 location

@@ 9-23 (lines=15) @@
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
8
9
class AssemblerFactory implements FactoryInterface
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

src/TemplateBuilderFactory.php 1 location

@@ 9-24 (lines=16) @@
6
use Zend\ServiceManager\ServiceLocatorInterface;
7
use Zend\ServiceManager\Exception\ServiceNotCreatedException;
8
9
class TemplateBuilderFactory implements FactoryInterface
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 TemplateBuilder(
20
            $config['t4web-mail'],
21
            $serviceLocator->get('ViewRenderer')
22
        );
23
    }
24
}
25