File size: 1,125 Bytes
d2897cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php

namespace Mautic\Middleware;

use Mautic\CoreBundle\Loader\ParameterLoader;

trait ConfigAwareTrait
{
    /**
     * @var array
     */
    protected $config = [];

    /**
     * @return array
     */
    public function getConfig()
    {
        // Include paths
        $root          = realpath(__DIR__.'/..');
        $configBaseDir = ParameterLoader::getLocalConfigBaseDir($root);
        $projectRoot   = ParameterLoader::getProjectDirByRoot($root);

        /** @var array $paths */
        include $root.'/config/paths.php';

        $localParameters = [];

        $localConfig = ParameterLoader::getLocalConfigFile($root, false);

        if (file_exists($localConfig)) {
            /** @var $parameters */
            include $localConfig;

            $localParameters = $parameters;
        }

        // check for parameter overrides
        if (file_exists($configBaseDir.'/config/parameters_local.php')) {
            include $configBaseDir.'/config/parameters_local.php';
            $localParameters = array_merge($localParameters, $parameters);
        }

        return $localParameters;
    }
}