/**
* @param NULL|array $params
*/
public function __construct(array $params = NULL)
{
parent::__construct();
$this->setTempDirectory(TEMP_DIR);
$defaults = array_map('realpath', ['appDir' => APP_DIR, 'binDir' => BIN_DIR, 'libsDir' => LIBS_DIR, 'wwwDir' => WWW_DIR, 'logDir' => LOG_DIR, 'configDir' => CONFIG_DIR, 'testsDir' => TESTS_DIR, 'migrationsDir' => MIGRATIONS_DIR]);
$defaults += ['testMode' => FALSE];
$this->addParameters((array) $params + $defaults);
foreach (get_class_methods($this) as $name) {
if ($pos = strpos($name, 'onInit') === 0 && $name !== 'onInitPackages') {
$this->onInit[lcfirst(substr($name, $pos + 5))] = [$this, $name];
}
}
foreach (get_class_methods($this) as $name) {
if ($pos = strpos($name, 'onAfter') === 0) {
$this->onAfter[lcfirst(substr($name, $pos + 5))] = [$this, $name];
}
}
$this->createRobotLoader()->register();
}