Skip to content

Commit

Permalink
Merge pull request #41 from sergiosalvatore/convertible-instantiation
Browse files Browse the repository at this point in the history
Convenience Method for Instantiating the Right FakePDO
  • Loading branch information
sergiosalvatore committed Jan 23, 2024
2 parents 926e1f1 + e550bd5 commit efb1538
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/FakePdo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
namespace Vimeo\MysqlEngine;

use PDO;

class FakePdo
{
/**
* @param string $connection_string the connection string
* @param string $username the username
* @param string $password the password
* @param array<array-key, string> $options any options
* @return PDO
*/
public static function getFakePdo(
string $connection_string,
string $username,
string $password,
array $options
): PDO {
if (\PHP_MAJOR_VERSION === 8) {
return new Php8\FakePdo($connection_string, $username, $password, $options);
}

return new Php7\FakePdo($connection_string, $username, $password, $options);
}
}

0 comments on commit efb1538

Please sign in to comment.