Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
installer_resources_locator
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
 locate_resources
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2/**
3 *
4 * This file is part of the phpBB Forum Software package.
5 *
6 * @copyright (c) phpBB Limited <https://www.phpbb.com>
7 * @license       GNU General Public License, version 2 (GPL-2.0)
8 *
9 * For full copyright and license information, please see
10 * the docs/CREDITS.txt file.
11 *
12 */
13
14namespace phpbb\routing\resources_locator;
15
16use phpbb\filesystem\filesystem_interface;
17
18/**
19 * Locates the yaml routing resources taking update directories into consideration
20 */
21class installer_resources_locator implements resources_locator_interface
22{
23    /**
24     * phpBB's filesystem handler
25     *
26     * @var filesystem_interface
27     */
28    protected $filesystem;
29
30    /**
31     * phpBB root path
32     *
33     * @var string
34     */
35    protected $phpbb_root_path;
36
37    /**
38     * Name of the current environment
39     *
40     * @var string
41     */
42    protected $environment;
43
44    /**
45     * Construct method
46     *
47     * @param filesystem_interface    $filesystem            phpBB's filesystem handler
48     * @param string                $phpbb_root_path    phpBB root path
49     * @param string                $environment        Name of the current environment
50     */
51    public function __construct(filesystem_interface $filesystem, $phpbb_root_path, $environment)
52    {
53        $this->filesystem            = $filesystem;
54        $this->phpbb_root_path        = $phpbb_root_path;
55        $this->environment            = $environment;
56    }
57
58    /**
59     * {@inheritdoc}
60     */
61    public function locate_resources()
62    {
63        if ($this->filesystem->exists($this->phpbb_root_path . 'install/update/new/config'))
64        {
65            $resources = array(
66                array('install/update/new/config/' . $this->environment . '/routing/environment.yml', 'yaml')
67            );
68        }
69        else
70        {
71            $resources = array(
72                array('config/' . $this->environment . '/routing/environment.yml', 'yaml')
73            );
74        }
75
76        return $resources;
77    }
78}