示例#1
0
 /**
  * Gets the default and possible currencies of the shop.
  *
  * @author David Pauli <*****@*****.**>
  * @since 0.0.0
  * @since 0.1.0 Use HTTPRequestMethod enum
  * @since 0.1.0 Save timestamp of the last request.
  * @since 0.1.0 Add configured used Currency.
  * @api
  */
 private static function load()
 {
     // if request method is blocked
     if (!RESTClient::setRequestMethod(HTTPRequestMethod::GET)) {
         return;
     }
     $content = RESTClient::send(self::RESTPATH);
     // if respond is empty or there are no default AND items element
     if (InputValidator::isEmptyArrayKey($content, "default") || InputValidator::isEmptyArrayKey($content, "items")) {
         Logger::error("Respond for " . self::RESTPATH . " can not be interpreted.");
         return;
     }
     // reset values
     self::resetValues();
     // save the default currency
     self::$DEFAULT = $content["default"];
     // parse the possible currencies
     self::$ITEMS = $content["items"];
     // set the configured shop Locale if it is empty.
     if (InputValidator::isEmpty(self::$USED)) {
         self::$USED = $content["default"];
     }
     // update timestamp when make the next request
     $timestamp = (int) (microtime(true) * 1000);
     self::$NEXT_REQUEST_TIMESTAMP = $timestamp + RESTClient::$NEXT_RESPONSE_WAIT_TIME;
 }