[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/phpbb/db/tools/ -> factory.php (source)

   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  
  14  namespace phpbb\db\tools;
  15  
  16  /**
  17   * A factory which serves the suitable tools instance for the given dbal
  18   */
  19  class factory
  20  {
  21      /**
  22       * @param mixed $db_driver
  23       * @param bool $return_statements
  24       * @return \phpbb\db\tools\tools_interface
  25       */
  26  	public function get($db_driver, $return_statements = false)
  27      {
  28          if ($db_driver instanceof \phpbb\db\driver\mssql_base)
  29          {
  30              return new \phpbb\db\tools\mssql($db_driver, $return_statements);
  31          }
  32          else if ($db_driver instanceof \phpbb\db\driver\postgres)
  33          {
  34              return new \phpbb\db\tools\postgres($db_driver, $return_statements);
  35          }
  36          else if ($db_driver instanceof \phpbb\db\driver\sqlite3)
  37          {
  38              return new \phpbb\db\tools\sqlite3($db_driver, $return_statements);
  39          }
  40          else if ($db_driver instanceof \phpbb\db\driver\driver_interface)
  41          {
  42              return new \phpbb\db\tools\tools($db_driver, $return_statements);
  43          }
  44  
  45          throw new \InvalidArgumentException('Invalid database driver given');
  46      }
  47  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1