/** * Library constructor * * You can either provide a BBConfiguration instance, or an api_key as the argument * * @param string|BBConfiguration * You can pass in either the api_key, or a customized BBConfiguration object */ function __construct($api_key = null) { //Determine the path to the library directory $this->lib_path = str_replace('\\', '/', dirname(__FILE__)) . '/lib/'; /** * Make sure this server supports json and cURL * Static because there's no point in checking for each instantiation */ self::$server_ready = self::check_server(); //Execute the static "constructor", but only for the first instantiation if (self::$first) { self::init($this); } //Use a custom BBConfiguration object if ($api_key instanceof BBConfiguration) { $this->config = $api_key; } else { $this->config = new BBConfiguration(); //Use a custom api_key if (!is_null($api_key)) { $this->config->api_key = $api_key; } } }