Beispiel #1
0
 public static function normalizeJson($value)
 {
     if (is_string($value) && mb_strlen($value) >= 2 && preg_match('%^(\\{.*\\}|\\[.*\\])$%s', $value)) {
         return $value;
     } else {
         return !is_string($value) && ValidateValue::isFloat($value) ? "{$value}" : json_encode($value, JSON_UNESCAPED_UNICODE);
     }
 }
Beispiel #2
0
 /**
  * @param int|null $height
  * @return $this
  * @throws ImageVersionConfigException
  */
 public function setHeight($height)
 {
     if ($height !== null && (!ValidateValue::isFloat($height, true) || $height < 0)) {
         throw new ImageVersionConfigException('Height should be a positive integer, 0 or null');
     }
     $this->height = (int) $height;
     return $this;
 }