diff options
author | Mate Bartus <mate.bartus@gmail.com> | 2015-07-25 14:43:54 +0200 |
---|---|---|
committer | Mate Bartus <mate.bartus@gmail.com> | 2015-07-25 14:43:54 +0200 |
commit | e8e9193690874e3006a7c60aaa58a22e46bce7ee (patch) | |
tree | 115636bb0a40ae007feb45510fec64a21062c9ec /phpBB/phpbb/install/helper | |
parent | 723337d2f68940eff64586cc91151fad2c40ea6e (diff) | |
download | forums-e8e9193690874e3006a7c60aaa58a22e46bce7ee.tar forums-e8e9193690874e3006a7c60aaa58a22e46bce7ee.tar.gz forums-e8e9193690874e3006a7c60aaa58a22e46bce7ee.tar.bz2 forums-e8e9193690874e3006a7c60aaa58a22e46bce7ee.tar.xz forums-e8e9193690874e3006a7c60aaa58a22e46bce7ee.zip |
[ticket/13740] Deduplicate container builder's checks
PHPBB3-13740
Diffstat (limited to 'phpBB/phpbb/install/helper')
-rw-r--r-- | phpBB/phpbb/install/helper/container_factory.php | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/phpBB/phpbb/install/helper/container_factory.php b/phpBB/phpbb/install/helper/container_factory.php index e09e43be34..dab16b81fd 100644 --- a/phpBB/phpbb/install/helper/container_factory.php +++ b/phpBB/phpbb/install/helper/container_factory.php @@ -73,16 +73,7 @@ class container_factory // Check if container was built, if not try to build it if ($this->container === null) { - // Check whether container can be built - // We need config.php for that so let's check if it has been set up yet - if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) - { - $this->build_container(); - } - else - { - throw new cannot_build_container_exception(); - } + $this->build_container(); } return ($service_name === null) ? $this->container : $this->container->get($service_name); @@ -102,16 +93,7 @@ class container_factory // Check if container was built, if not try to build it if ($this->container === null) { - // Check whether container can be built - // We need config.php for that so let's check if it has been set up yet - if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) - { - $this->build_container(); - } - else - { - throw new cannot_build_container_exception(); - } + $this->build_container(); } return $this->container->getParameter($param_name); @@ -119,6 +101,8 @@ class container_factory /** * Build dependency injection container + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built */ protected function build_container() { @@ -129,6 +113,17 @@ class container_factory return; } + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + $this->build_container(); + } + else + { + throw new cannot_build_container_exception(); + } + $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext); $phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext); |