for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace AsyncPHP\Icicle\Database;
use AsyncPHP\Icicle\Database\Builder\AuraBuilder;
use Aura\SqlQuery\QueryFactory;
use InvalidArgumentException;
final class BuilderFactory
{
/**
* @param array $config
*
* @return Builder
* @throw InvalidArgumentException
*/
public function create(array $config)
if (!isset($config["driver"])) {
throw new InvalidArgumentException("Undefined driver");
}
if ($config["driver"] === "mssql") {
return new AuraBuilder(
new QueryFactory("sqlsrv")
);
if ($config["driver"] === "mysql") {
new QueryFactory("mysql")
if ($config["driver"] === "postgresql") {
new QueryFactory("pgsql")
if ($config["driver"] === "sqlite") {
new QueryFactory("sqlite")
throw new InvalidArgumentException("Unrecognised driver");