$attribute_value) { if (property_exists(__CLASS__, $attribute_name)) { $instance->{$attribute_name} = $attribute_value; } } return $instance; } /** * @return string */ public function getWebName() { return $this->path . '/' . $this->filename; } public function __toString() { return self::toString($this); } private static function toString($class) { $data = array(); foreach ($class as $attribute_name => $attribute_value) { $data[$attribute_name] = $attribute_value; } return json_encode($data); } }