Alcaeus\MongoDbAdapter\TypeConverter::convertBSONObjectToLegacy PHP Method

convertBSONObjectToLegacy() private static method

Converter method to convert a BSON object to its legacy type
private static convertBSONObjectToLegacy ( MongoDB\BSON\Type $value ) : mixed
$value MongoDB\BSON\Type
return mixed
    private static function convertBSONObjectToLegacy(BSON\Type $value)
    {
        switch (true) {
            case $value instanceof BSON\ObjectID:
                return new \MongoId($value);
            case $value instanceof BSON\Binary:
                return new \MongoBinData($value);
            case $value instanceof BSON\Javascript:
                return new \MongoCode($value);
            case $value instanceof BSON\MaxKey:
                return new \MongoMaxKey();
            case $value instanceof BSON\MinKey:
                return new \MongoMinKey();
            case $value instanceof BSON\Regex:
                return new \MongoRegex($value);
            case $value instanceof BSON\Timestamp:
                return new \MongoTimestamp($value);
            case $value instanceof BSON\UTCDatetime:
                return new \MongoDate($value);
            case $value instanceof Model\BSONDocument:
            case $value instanceof Model\BSONArray:
                return array_map(['self', 'toLegacy'], $value->getArrayCopy());
            default:
                return $value;
        }
    }