/** * Instantiate class * @return void */ public function __construct() { // Set debug mode $this->debug = defined('DEBUG') ? DEBUG : $this->debug; // Set default resources $this->resources = Sonic::getSelectedResources(); // If the object variable exists and isnt set then assign it foreach (array_keys($this->resources) as $name) { if (isset($this->{$name}) && $this->{$name} === FALSE) { $this->{$name} =& $this->resources[$name]; } } // If there are any class defaults set them foreach (static::$defaultResources as $name => $resource) { if (!$this->setResource($name, $resource)) { throw new Exception('Framework resource `' . print_r($resource, TRUE) . '` does not exist for ' . get_called_class()); } } }