diff --git a/File.class.php b/File.class.php index e44028b..25ebabe 100644 --- a/File.class.php +++ b/File.class.php @@ -12,8 +12,8 @@ abstract class File public static function getInstance($data) { $instance = new static($data); - if (is_null($data)) { - throw new ErrorException('Empty data for Image::getInstance().'); + if (is_null($data) || $data == '') { + throw new ErrorException('Empty data for File::getInstance().'); } if (!is_array($data)) { $data = json_decode($data, true); @@ -22,7 +22,7 @@ abstract class File } } foreach ($data as $attribute_name => $attribute_value) { - if (property_exists(__CLASS__, $attribute_name)) { + if (property_exists($instance, $attribute_name)) { $instance->{$attribute_name} = $attribute_value; } } diff --git a/Image.class.php b/Image.class.php index b4093d5..194639b 100644 --- a/Image.class.php +++ b/Image.class.php @@ -14,7 +14,8 @@ class Image extends File const SIZE_200_160 = '200x160'; const SIZE_300_240 = '300x240'; const SIZE_550_440 = '550x440'; - const SIZE_SKI = '1000x'; + const SIZE_SKI = 'x'; + const SIZE_INSTRUCTION = 'x'; public static $sizes = array( self::SIZE_100_80,