$value) { $this->{$key} = $value; } // if "backupLocation" is not set, let's set one automatically if (!isset($config['backupLocation'])) { $this->backupLocation = $this->dir.'/backups'; } $this->validateFormatClass(); } /** * format * * kind of a quick fix since we are using static methods, * currently need to instantiate teh class to check instanceof why?? * * Checks the format of the database being accessed */ protected function validateFormatClass() { if (!class_exists($this->format)) { throw new \Exception('Filebase Error: Missing format class in config.'); } // instantiate the format class $format_class = new $this->format; // check now if that class is part of our interface if (!$format_class instanceof \Filebase\Format\FormatInterface) { throw new \Exception('Filebase Error: Format Class must be an instance of Filebase\Format\FormatInterface'); } } }