File: //homepages/oneclick/WordPress/6.9/601/scripts/factory/factory.php
<?php
namespace Factory;
use \Core\Environment;
use \Core\Database;
use \Exception;
class Factory
{
public function factory($appName, Environment $env, Database $db)
{
// Class name is the same as app name
$wrapperName = $appName;
if (!file_exists('wrappers/' . $wrapperName . '.php')) {
throw new Exception("wrapper $wrapperName not implemented.");
}
$className = "\\Wrappers\\" . $wrapperName;
return new $className($appName, $env, $db);
}
}