Back to InstallerAdapter class

Method __construct

public
__construct
(\Joomla\CMS\Installer\Installer $parent, \Joomla\Database\DatabaseDriver $db, array $options = array())
Constructor
Parameters
  • \Joomla\CMS\Installer\Installer $parent Parent object
  • \Joomla\Database\DatabaseDriver $db Database object
  • array $options Configuration Options
Since
  • 3.4

Method __construct - Source code

/**
 * Constructor
 *
 * @param   Installer       $parent   Parent object
 * @param   DatabaseDriver  $db       Database object
 * @param   array           $options  Configuration Options
 *
 * @since   3.4
 */
public function __construct(Installer $parent, DatabaseDriver $db, array $options = array())
{
    $this->parent = $parent;
    $this->db = $db;
    foreach ($options as $key => $value) {
        if (property_exists($this, $key)) {
            $this->{$key} = $value;
        }
    }
    // Get a generic TableExtension instance for use if not already loaded
    if (!$this->extension instanceof TableInterface) {
        $this->extension = Table::getInstance('extension');
    }
    // Sanity check, make sure the type is set by taking the adapter name from the class name
    if (!$this->type) {
        // This assumes the adapter short class name in its namespace is `<foo>Adapter`, replace this logic in subclasses if needed
        $reflection = new \ReflectionClass(\get_called_class());
        $this->type = str_replace('Adapter', '', $reflection->getShortName());
    }
    // Extension type is stored as lowercase in the database
    $this->type = strtolower($this->type);
}