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

AbstractFactory::mergeConfiguration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
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