/**
  * This is the constructor of the Order.
  *
  * @author David Pauli <*****@*****.**>
  * @param mixed[]|String $orderParameter The order to create as array or order ID.
  * @since 0.1.3
  */
 public function __construct($orderParameter)
 {
     if (!InputValidator::isString($orderParameter) && !InputValidator::isArray($orderParameter)) {
         self::errorSet("O-1");
         Logger::warning("ep6\\Order\nOrder parameter " . $orderParameter . " to create order is invalid.");
         return;
     }
     if (InputValidator::isArray($orderParameter)) {
         $this->parseData($orderParameter);
     } else {
         $this->orderId = $orderParameter;
         $this->reload();
     }
 }
 /**
  * This is the constructor.
  *
  * This function extracts the date.
  *
  * @author David Pauli <*****@*****.**>
  * @param String $date The date to set (timestamp or strtotime allowed string).
  * @since 0.1.3
  * @since 0.2.1 Extend constructor to use also timestamps.
  */
 public function __construct($date)
 {
     // if parameter is no string
     if (InputValidator::isTimestamp($date)) {
         $timestamp = $date;
     } else {
         if (InputValidator::isString($date)) {
             // try to convert to a timestamp
             $timestamp = strtotime($date);
         } else {
             $this->errorSet("D-1");
             Logger::error("ep6\\Date\nThe parameter date " . $date . " is no string.");
             return;
         }
     }
     if (!$timestamp) {
         $this->errorSet("D-2");
         Logger::error("ep6\\Date\nThe parameter date " . $date . " is no valid date format.");
         return;
     }
     $this->timestamp = $timestamp;
 }
 /**
  * @group utility
  */
 function testIsString()
 {
     $this->assertTrue(InputValidator::isString("String"));
     $this->assertFalse(InputValidator::isString(array()));
     $this->assertFalse(InputValidator::isString(array(12)));
     $this->assertFalse(InputValidator::isString(3));
     $this->assertFalse(InputValidator::isString(null));
     $this->assertFalse(InputValidator::isString(1.2));
 }
 /**
  * Sets an attribute of the product.
  *
  * @author David Pauli <*****@*****.**>
  * @param String $path The path to this attribute.
  * @param String $value The new attribute value.
  * @since 0.1.2
  */
 private function setAttribute($path, $value)
 {
     // if parameter is no string or
     if (!InputValidator::isString($value)) {
         Logger::warning("ep6\\Product\nNew attribute (" . $value . ") is no string.");
         self::errorSet("P-2");
         return;
     }
     // if PATCH does not work
     if (!RESTClient::setRequestMethod("PATCH")) {
         self::errorSet("RESTC-9");
         return;
     }
     $parameter = array("op" => "add", "path" => $path, "value" => $value);
     $productParameter = RESTClient::send(self::RESTPATH . "/" . $this->productID, $parameter);
     // update the product
     $this->parseData($productParameter);
 }