SimpleSAML\Database::getInstance PHP Метод

getInstance() публичный статический Метод

Retrieves the current database instance. Will create a new one if there isn't an existing connection.
public static getInstance ( SimpleSAML_Configuration $altConfig = null ) : Database
$altConfig SimpleSAML_Configuration Optional: Instance of a SimpleSAML_Configuration class
Результат Database The shared database connection.
    public static function getInstance($altConfig = null)
    {
        $config = $altConfig ? $altConfig : \SimpleSAML_Configuration::getInstance();
        $instanceId = self::generateInstanceId($config);
        // check if we already have initialized the session
        if (isset(self::$instance[$instanceId])) {
            return self::$instance[$instanceId];
        }
        // create a new session
        self::$instance[$instanceId] = new Database($config);
        return self::$instance[$instanceId];
    }