Skip to content

Commit db93106

Browse files
committed
Add __toString()
1 parent 8553070 commit db93106

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/FileSize.php

+11-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function as($unitString, $precision = 2)
156156
}
157157

158158
/**
159-
* Get the filesize in a human-friendly string.
159+
* Get the filesize as a human-friendly string.
160160
*
161161
* @param int $precision Round to this many decimal places
162162
* @return string
@@ -170,6 +170,16 @@ public function asAuto($precision = 2)
170170
return self::formatNumber($size, $precision, $unit);
171171
}
172172

173+
/**
174+
* Print the filesize as a human-friendly string.
175+
*
176+
* @return string
177+
*/
178+
public function __toString()
179+
{
180+
return $this->asAuto();
181+
}
182+
173183
/**
174184
* Change the filesize unit measurement using arbitrary units.
175185
*

0 commit comments

Comments
 (0)