aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/db/tools
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2015-01-10 15:43:18 +0100
committerJoas Schilling <nickvergessen@gmx.de>2015-01-10 16:25:24 +0100
commit11b6bc5722a6a4aed1cd45ce65f2d9cf16ae7dd5 (patch)
tree9aea9070b49fabf0ca0040f4ff3e6cae1cad8988 /phpBB/phpbb/db/tools
parent45ccd2d44afe78838f5e782c0c559e2d082536d8 (diff)
downloadforums-11b6bc5722a6a4aed1cd45ce65f2d9cf16ae7dd5.tar
forums-11b6bc5722a6a4aed1cd45ce65f2d9cf16ae7dd5.tar.gz
forums-11b6bc5722a6a4aed1cd45ce65f2d9cf16ae7dd5.tar.bz2
forums-11b6bc5722a6a4aed1cd45ce65f2d9cf16ae7dd5.tar.xz
forums-11b6bc5722a6a4aed1cd45ce65f2d9cf16ae7dd5.zip
[ticket/13487] Add factory for db tool class
This allows us to split up the large file one by one easily. PHPBB3-13487
Diffstat (limited to 'phpBB/phpbb/db/tools')
-rw-r--r--phpBB/phpbb/db/tools/factory.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/phpBB/phpbb/db/tools/factory.php b/phpBB/phpbb/db/tools/factory.php
new file mode 100644
index 0000000000..60db2ade03
--- /dev/null
+++ b/phpBB/phpbb/db/tools/factory.php
@@ -0,0 +1,35 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\tools;
+
+/**
+ * A factory which serves the suitable tools instance for the given dbal
+ */
+class factory
+{
+ /**
+ * @param mixed $db_driver
+ * @param bool $return_statements
+ * @return \phpbb\db\tools\tools_interface
+ */
+ public function get($db_driver, $return_statements = false)
+ {
+ if ($db_driver instanceof \phpbb\db\driver\driver_interface)
+ {
+ return new \phpbb\db\tools\tools($db_driver, $return_statements);
+ }
+
+ throw new \InvalidArgumentException('Invalid database driver given');
+ }
+}