lithium\data\source\MongoDb::enabled()

public static method

With no parameter, checks to see if adapter's dependencies are installed. With a parameter, queries for a specific supported feature.

A compatibility layer cannot be detected via extension_loaded(), thus we check for the existence of one of the legacy classes to determine if this adapter can be enabled at all.

Parameters

  • string $feature

    Test for support for a specific feature, i.e. "transactions" or "arrays".

Returns

boolean

Returns true if the particular feature (or if MongoDB) support is enabled, otherwise false.

Source

	public static function enabled($feature = null) {
		if (!$feature) {
			return class_exists('MongoClient');
		}
		$features = [
			'arrays' => true,
			'transactions' => false,
			'booleans' => true,
			'relationships' => true,
			'schema' => false,
			'sources' => true
		];
		return isset($features[$feature]) ? $features[$feature] : null;
	}