lithium\data\source\MongoDb::enabled()
Overrides
lithium\data\Source::enabled()
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
booleanReturns 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;
}