![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/vendor/knplabs/gaufrette/src/Gaufrette/Util/ |
<?php namespace Gaufrette\Util; /** * Utility class for file sizes. * * @author Antoine Hérault <[email protected]> */ class Size { /** * Returns the size in bytes from the given content. * * @param string $content * * @return int * * @todo handle the case the mbstring is not loaded */ public static function fromContent($content) { // Make sure to get the real length in byte and not // accidentally mistake some bytes as a UTF BOM. return mb_strlen($content, '8bit'); } /** * Returns the size in bytes from the given file. * * @param string $filename * * @return int */ public static function fromFile($filename) { return filesize($filename); } /** * Returns the size in bytes from the given resource. * * @param resource $handle * * @return string */ public static function fromResource($handle) { $cStat = fstat($handle); // if the resource is a remote file, $cStat will be false return $cStat ? $cStat['size'] : 0; } }