private function MongoDbProfilerStorage::parseDsn in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php \Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage::parseDsn()
 
Parameters
string $dsn:
Return value
null|array Array($server, $database, $collection)
1 call to MongoDbProfilerStorage::parseDsn()
- MongoDbProfilerStorage::getMongo in vendor/
symfony/ http-kernel/ Profiler/ MongoDbProfilerStorage.php  - Internal convenience method that returns the instance of the MongoDB Collection.
 
File
- vendor/
symfony/ http-kernel/ Profiler/ MongoDbProfilerStorage.php, line 242  
Class
Namespace
Symfony\Component\HttpKernel\ProfilerCode
private function parseDsn($dsn) {
  if (!preg_match('#^(mongodb://.*)/(.*)/(.*)$#', $dsn, $matches)) {
    return;
  }
  $server = $matches[1];
  $database = $matches[2];
  $collection = $matches[3];
  preg_match('#^mongodb://(([^:]+):?(.*)(?=@))?@?([^/]*)(.*)$#', $server, $matchesServer);
  if ('' == $matchesServer[5] && '' != $matches[2]) {
    $server .= '/' . $matches[2];
  }
  return array(
    $server,
    $database,
    $collection,
  );
}