src/Common/Model/BaseDriver.php
public function getInstance($sSlug)
    {
        if (isset($this->aInstances[$sSlug])) {

            return $this->aInstances[$sSlug];

        } else {

            foreach ($this->aComponents as $oDriverConfig) {
                if ($sSlug == $oDriverConfig->slug) {
                    $oDriver = $oDriverConfig;
                    break;
                }
            }

            if (!empty($oDriver)) {

                $this->aInstances[$oDriver->slug] = Components::getDriverInstance($oDriver);

                //  Apply driver configurations
                $aSettings = [
                    'sSlug' => $oDriver->slug,
                ];
                if (!empty($oDriver->data->settings)) {
                    $aSettings = array_merge(
                        $aSettings,
                        $this->extractComponentSettings(
                            $oDriver->data->settings,
                            $oDriver->slug
                        )
                    );
                }

                $this->aInstances[$sSlug]->setConfig($aSettings);

                return $this->aInstances[$sSlug];
            }
        }

        return null;
    }
public function getInstance($sSlug)
    {
        if (isset($this->aInstances[$sSlug])) {

            return $this->aInstances[$sSlug];

        } else {

            foreach ($this->aComponents as $oDriverConfig) {
                if ($sSlug == $oDriverConfig->slug) {
                    $oDriver = $oDriverConfig;
                    break;
                }
            }

            if (!empty($oDriver)) {

                $this->aInstances[$oDriver->slug] = Components::getDriverInstance($oDriver);

                //  Apply driver configurations
                $aSettings = [
                    'sSlug' => $oDriver->slug,
                ];
                if (!empty($oDriver->data->settings)) {
                    $aSettings = array_merge(
                        $aSettings,
                        $this->extractComponentSettings(
                            $oDriver->data->settings,
                            $oDriver->slug
                        )
                    );
                }

                $this->aInstances[$sSlug]->setConfig($aSettings);

                return $this->aInstances[$sSlug];
            }
        }

        return null;
    }
public function getInstance ( $ sSlug ) { if ( isset ( $ this -> aInstances [ $ sSlug ] ) ) { return $ this -> aInstances [ $ sSlug ] ; } else { foreach ( $ this -> aComponents as $ oDriverConfig ) { if ( $ sSlug == $ oDriverConfig -> slug ) { $ oDriver = $ oDriverConfig ; break ; } } if ( ! empty ( $ oDriver ) ) { $ this -> aInstances [ $ oDriver -> slug ] = Components :: getDriverInstance ( $ oDriver ) ; //  Apply driver configurations $ aSettings = [ 'sSlug' => $ oDriver -> slug , ] ; if ( ! empty ( $ oDriver -> data -> settings ) ) { $ aSettings = array_merge ( $ aSettings , $ this -> extractComponentSettings ( $ oDriver -> data -> settings , $ oDriver -> slug ) ) ; } $ this -> aInstances [ $ sSlug ] -> setConfig ( $ aSettings ) ; return $ this -> aInstances [ $ sSlug ] ; } } return null ; }
Return an instance of the driver.

@param  string $sSlug The driver's slug

@return mixed
Return an instance of the driver .