$attribute_value) { if (property_exists($instance, $attribute_name)) { $instance->{$attribute_name} = $attribute_value; } } return $instance; } /** * @param $size string * @return ImageVariant */ public function getImageVariant($size) { if (!array_key_exists($size, $this->variants)) { $this->variants[$size] = new ImageVariant; } else { if (!is_object($this->variants[$size])) { $this->variants[$size] = parent::getInstance($this->variants[$size]); } } return $this->variants[$size]; } /** * @return string */ public function getWebName() { return $this->path . '/' . $this->filename; } public function __toString() { return FileHelper::toString($this); } }