[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
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\extractor; 15 16 /** 17 * A factory which serves the suitable extractor instance for the given dbal 18 */ 19 class factory 20 { 21 /** 22 * @var \phpbb\db\driver\driver_interface 23 */ 24 protected $db; 25 26 /** 27 * @var \Symfony\Component\DependencyInjection\ContainerInterface 28 */ 29 protected $container; 30 31 /** 32 * Extractor factory constructor 33 * 34 * @param \phpbb\db\driver\driver_interface $db 35 * @param \Symfony\Component\DependencyInjection\ContainerInterface $container 36 */ 37 public function __construct(\phpbb\db\driver\driver_interface $db, \Symfony\Component\DependencyInjection\ContainerInterface $container) 38 { 39 $this->db = $db; 40 $this->container = $container; 41 } 42 43 /** 44 * DB extractor factory getter 45 * 46 * @return \phpbb\db\extractor\extractor_interface an appropriate instance of the database extractor for the used database driver 47 * @throws \InvalidArgumentException when the database driver is unknown 48 */ 49 public function get() 50 { 51 // Return the appropriate DB extractor 52 if ($this->db instanceof \phpbb\db\driver\mssql_base) 53 { 54 return $this->container->get('dbal.extractor.extractors.mssql_extractor'); 55 } 56 else if ($this->db instanceof \phpbb\db\driver\mysql_base) 57 { 58 return $this->container->get('dbal.extractor.extractors.mysql_extractor'); 59 } 60 else if ($this->db instanceof \phpbb\db\driver\oracle) 61 { 62 return $this->container->get('dbal.extractor.extractors.oracle_extractor'); 63 } 64 else if ($this->db instanceof \phpbb\db\driver\postgres) 65 { 66 return $this->container->get('dbal.extractor.extractors.postgres_extractor'); 67 } 68 else if ($this->db instanceof \phpbb\db\driver\sqlite3) 69 { 70 return $this->container->get('dbal.extractor.extractors.sqlite3_extractor'); 71 } 72 73 throw new \InvalidArgumentException('Invalid database driver given'); 74 } 75 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |