Browse Source

Add support for cases where the scheme is not a useful value - such as the Log class

In the case of the Log class, the `scheme` maps roughly to a className value, though we need a valid string in order for parse_url to return correctly.
Jose Diaz-Gonzalez 11 years ago
parent
commit
9d78414d16
1 changed files with 5 additions and 0 deletions
  1. 5 0
      src/Core/StaticConfigTrait.php

+ 5 - 0
src/Core/StaticConfigTrait.php

@@ -159,6 +159,11 @@ trait StaticConfigTrait {
 			$scheme = $matches[1];
 			$driver = $matches[2];
 			$dsn = preg_replace("/^([\w]+)\+([\w\\\]+)/", $scheme, $dsn);
+		} elseif (preg_match("/^([\w\\\]+)/", $dsn, $matches)) {
+			$scheme = explode('\\', $matches[1]);
+			$scheme = array_pop($scheme);
+			$driver = $matches[1];
+			$dsn = preg_replace("/^([\w\\\]+)/", $scheme, $dsn);
 		}
 
 		$parsed = parse_url($dsn);