/**
  * This function gets the product images.
  *
  * @author David Pauli <*****@*****.**>
  * @since 0.1.0
  * @since 0.1.1 Fix bug with nonsetted product URL and delete reload functionality.
  * @since 0.1.1 Use unstatic variables.
  * @api
  * @param String $productID The product ID to get images.
  */
 private function load($productID)
 {
     // if parameter is wrong or GET is blocked
     if (!InputValidator::isProductId($productID) || !RESTClient::setRequestMethod(HTTPRequestMethod::GET)) {
         return;
     }
     $content = RESTClient::send("products/" . $productID . "/" . self::RESTPATH);
     // if respond is empty
     if (InputValidator::isEmpty($content)) {
         return;
     }
     // if there is items
     if (InputValidator::isEmptyArrayKey($content, "items")) {
         Logger::error("Respond for product/" . $productID . "/" . self::RESTPATH . " can not be interpreted.");
         return;
     }
     // is there any images found: load the images.
     foreach ($content['items'] as $number => $image) {
         // parse every image size
         if (!InputValidator::isEmptyArrayKey($image, "sizes")) {
             $object = null;
             foreach ($image["sizes"] as $size) {
                 // if there is "url" and "classifier" set in the image
                 if (!InputValidator::isEmptyArrayKey($size, "url") && !InputValidator::isEmptyArrayKey($size, "classifier")) {
                     $object[$size["classifier"]] = $size["url"];
                 }
             }
             // if all needed sizes are available, save it
             if (!InputValidator::isEmptyArrayKey($object, "Thumbnail") && !InputValidator::isEmptyArrayKey($object, "Small") && !InputValidator::isEmptyArrayKey($object, "HotDeal") && !InputValidator::isEmptyArrayKey($object, "MediumSmall") && !InputValidator::isEmptyArrayKey($object, "Medium") && !InputValidator::isEmptyArrayKey($object, "MediumLarge") && !InputValidator::isEmptyArrayKey($object, "Large")) {
                 array_push($this->images, $object);
             }
         }
     }
 }
 /**
  * This function gets the product images.
  *
  * @author David Pauli <*****@*****.**>
  * @param String $productID The product ID to get images.
  * @since 0.1.0
  * @since 0.1.1 Fix bug with nonsetted product URL and delete reload functionality.
  * @since 0.1.1 Use unstatic variables.
  * @since 0.1.2 Add error reporting.
  * @since 0.2.1 Implement REST client fixes.
  */
 private function load($productID)
 {
     // if parameter is wrong
     if (!InputValidator::isProductId($productID)) {
         $this->errorSet("PS-1");
         Logger::warning("ep6\\ProductSlideshow\nInvalid product ID " . $productId . " to load slideshow.");
         return;
     }
     // if GET is blocked
     if (!RESTClient::setRequestMethod(HTTPRequestMethod::GET)) {
         $this->errorSet("RESTC-9");
         return;
     }
     RESTClient::send("products/" . $productID . "/" . self::RESTPATH);
     $content = RESTClient::getJSONContent();
     // if respond is empty
     if (InputValidator::isEmpty($content)) {
         $this->errorSet("PS-2");
         Logger::warning("ep6\\ProductSlideshow\nEmpty response while getting product slideshow.");
         return;
     }
     // if there is items
     if (InputValidator::isEmptyArrayKey($content, "items")) {
         $this->errorSet("PS-3");
         Logger::error("Respond for product slidehows can not be interpreted.");
         return;
     }
     // is there any images found: load the images.
     foreach ($content['items'] as $number => $image) {
         // parse every image size
         if (!InputValidator::isEmptyArrayKey($image, "sizes")) {
             $object = null;
             foreach ($image["sizes"] as $size) {
                 // if there is "url" and "classifier" set in the image
                 if (!InputValidator::isEmptyArrayKey($size, "url") && !InputValidator::isEmptyArrayKey($size, "classifier")) {
                     $object[$size["classifier"]] = $size["url"];
                 }
             }
             // if all needed sizes are available, save it
             if (!InputValidator::isEmptyArrayKey($object, "Thumbnail") && !InputValidator::isEmptyArrayKey($object, "Small") && !InputValidator::isEmptyArrayKey($object, "HotDeal") && !InputValidator::isEmptyArrayKey($object, "MediumSmall") && !InputValidator::isEmptyArrayKey($object, "Medium") && !InputValidator::isEmptyArrayKey($object, "MediumLarge") && !InputValidator::isEmptyArrayKey($object, "Large")) {
                 array_push($this->images, $object);
             }
         }
     }
 }
 /**
  * @group utility
  */
 function testIsProductId()
 {
     $this->assertFalse(InputValidator::isProductId(null));
     $this->assertFalse(InputValidator::isProductId(""));
     $this->assertTrue(InputValidator::isProductId("SomeString"));
 }