Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

factory.php

Zuletzt modifiziert: 09.10.2024, 12:54 - Dateigröße: 2.03 KiB


 01  <?php
 02  /**
 03  *
 04  * This file is part of the phpBB Forum Software package.
 05  *
 06  * @copyright (c) phpBB Limited <https://www.phpbb.com>
 07  * @license GNU General Public License, version 2 (GPL-2.0)
 08  *
 09  * 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  }
 76