Ejemplo n.º 1
0
 public static function init($apiKey = null)
 {
     if (is_null(self::$instance)) {
         if (!defined('_DEF_LOGRIVER_API_KEY')) {
             define('_DEF_LOGRIVER_API_KEY', $apiKey);
             require dirname(__FILE__) . '/Global.php';
             // __DIR__ appears only in Php 5.3
         }
         if ($apiKey === null) {
             throw new Exception("apiKey parameter is required");
         } elseif (!is_string($apiKey) || is_string($apiKey) && strlen($apiKey) !== 32) {
             throw new Exception("apiKey parameter is not correct");
         }
         self::$instance = new self($apiKey);
     }
     return self::$instance;
 }