Completed
Pull Request — master (#165)
by Paul
03:21
created

AbstractFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 20
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
processConfiguration() 0 1 ?
A mergeConfiguration() 0 4 1
1
<?php
2
/**
3
 * This file is part of the PPI Framework.
4
 *
5
 * @copyright   Copyright (c) 2011-2016 Paul Dragoonis <[email protected]>
6
 * @license     http://opensource.org/licenses/mit-license.php MIT
7
 *
8
 * @link        http://www.ppi.io
9
 */
10
11
namespace PPI\Framework\ServiceManager\Factory;
12
13
use PPI\Framework\Config\ConfigurationProviderInterface;
14
use Zend\ServiceManager\FactoryInterface;
15
use Zend\ServiceManager\ServiceLocatorInterface;
16
use Zend\Stdlib\ArrayUtils;
17
18
/**
19
 * AbstractFactory.
20
 *
21
 * @author     Vítor Brandão <[email protected]>
22
 */
23
abstract class AbstractFactory implements FactoryInterface, ConfigurationProviderInterface
24
{
25
    /**
26
     * Process an array with the application configuration.
27
     *
28
     * @param array                                        $config
29
     * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
30
     *
31
     * @return array
32
     */
33
    abstract protected function processConfiguration(array $config, ServiceLocatorInterface $serviceLocator = null);
34
35
    /**
36
     * Merges configuration.
37
     */
38
    protected function mergeConfiguration(array $defaults, array $config)
39
    {
40
        return ArrayUtils::merge($defaults, $config);
41
    }
42
}
43