Esempio n. 1
0
 public function __construct($debug = null)
 {
     if ($debug == null) {
         $this->debug = UPS::getDebug();
     }
     $loadedExtensions = get_loaded_extensions();
     if (!in_array('curl', $loadedExtensions)) {
         throw new \Exception('CURL extension must be installed in order to use ' . UPS::$libraryName);
     }
     if (!in_array('dom', $loadedExtensions)) {
         throw new \Exception('DOM extension must be installed in order to use ' . UPS::$libraryName);
     }
     if (!in_array('SimpleXML', $loadedExtensions)) {
         throw new \Exception('SimpleXML extension must be installed in order to use ' . UPS::$libraryName);
     }
     if (!in_array('date', $loadedExtensions)) {
         throw new \Exception('Date extension must be installed in order to use ' . UPS::$libraryName);
     }
     if (version_compare(PHP_VERSION, '5.3.0') < 1) {
         throw new \Exception(UPS::$libraryName . ' requires at least PHP version 5.3');
     }
     unset($loadedExtensions);
     $this->setAccessLicenseNumber(UPS::getAccessLicenseNumber());
     $this->setUserId(UPS::getUserId());
     $this->setPassword(UPS::getPassword());
     libxml_use_internal_errors(true);
 }