method __construct documentation in bbn\Mvc
This should be called only once from within the app
function($db = NULL, $routes = [])
{
self::singletonInit($this);
self::initPath();
$this->env = new Environment();
if (\is_object($db) && ($class = \get_class($db)) && ($class === 'PDO' || strpos($class, '\Db') !== false)) {
$this->db = $db;
} else {
$this->db = null;
}
$this->inc = new \stdClass();
if (\is_array($routes)) {
if (isset($routes['root'])) {
foreach ($routes['root'] as $url => &$route) {
if (isset($route['root']) && defined('BBN_' . strtoupper($route['root']) . '_PATH')) {
$route['path'] = constant('BBN_' . strtoupper($route['root']) . '_PATH') . $route['path'];
}
if (!empty($route['path']) && (substr($route['path'], -1) !== '/')) {
$route['path'] .= '/';
}
if (isset($route['path'])) {
$route['url'] = $url;
$this->registerPlugin($route);
}
}
}
if (isset($routes['allowed'])) {
$this->authorized_routes = $routes['allowed'];
}
if (isset($routes['forbidden'])) {
$this->forbidden_routes = $routes['forbidden'];
}
}
$this->initLocaleDomain();
$this->router = new Router($this, $routes);
$this->route();
}
This should be called only once from within the app BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2025
BBN Solutions