Skip to content

Commit efb1538

Browse files
Merge pull request #41 from sergiosalvatore/convertible-instantiation
Convenience Method for Instantiating the Right FakePDO
2 parents 926e1f1 + e550bd5 commit efb1538

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/FakePdo.php

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
namespace Vimeo\MysqlEngine;
3+
4+
use PDO;
5+
6+
class FakePdo
7+
{
8+
/**
9+
* @param string $connection_string the connection string
10+
* @param string $username the username
11+
* @param string $password the password
12+
* @param array<array-key, string> $options any options
13+
* @return PDO
14+
*/
15+
public static function getFakePdo(
16+
string $connection_string,
17+
string $username,
18+
string $password,
19+
array $options
20+
): PDO {
21+
if (\PHP_MAJOR_VERSION === 8) {
22+
return new Php8\FakePdo($connection_string, $username, $password, $options);
23+
}
24+
25+
return new Php7\FakePdo($connection_string, $username, $password, $options);
26+
}
27+
}

0 commit comments

Comments
 (0)