public function __construct($config = null, array $module = null, Router $router = null)
{
if (null !== $config) {
$this->loadConfig($config);
}
if (null !== $module) {
$this->loadModule($module);
}
if (null !== $router) {
$this->loadRouter($router);
}
$this->events = new \Pop\Event\Manager();
$this->services = new \Pop\Service\Locator();
if (isset($this->config->log)) {
if (!file_exists($this->config->log)) {
touch($this->config->log);
chmod($this->config->log, 0777);
}
$this->logger = new \Pop\Log\Logger(new \Pop\Log\Writer\File(realpath($this->config->log)));
}
if (isset($this->config->defaultDb)) {
$default = $this->config->defaultDb;
\Pop\Db\Record::setDb($this->config->databases->{$default});
}
}