method __construct documentation in bbn\Cdn

Constructor.

Generates a configuration based on the given request and instantiate a compiler for the response. If $db is not not given the current instance if any will be used.

function(string $request, bbn\Db $db = NULL) { // Need to be in a bbn environment, this is the absolute path of the server's root directory if (!defined('BBN_PUBLIC')) { $this->error('You must define the constant $this->fpath as the root of your public document'); die('You must define the constant $this->fpath as the root of your public document'); } /** @todo Remove? */ $this->_set_prefix(); if (!$db) { $db = Db::getInstance(); } if ($db) { $this->db = $db; } $this->request = $request; // Creation of a config object $config = new Cdn\Config($request, $this->db); // Checking request validity if ($config->check()) { // Getting a configuration array $this->cfg = $config->get(); if (!empty($this->cfg['content']['js']) || $this->cfg['is_component']) { $this->mode = 'js'; } else { if (!empty($this->cfg['content']['css'])) { $this->mode = 'css'; } } if ($this->mode) { $this->cp = new Cdn\Compiler($this->cfg); } } }

Constructor. 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.