public function testFriendlyFileSize()
 {
     $units = array('', 'k', 'M', 'G', 'T', 'P');
     $this->assertEquals(TextUtils::friendlyFileSize(0), '0');
     $this->assertEquals(TextUtils::friendlyFileSize(1024), '1k');
     $this->assertEquals(TextUtils::friendlyFileSize(812), '812');
     for ($i = 0; $i < 6; ++$i) {
         $this->assertEquals(TextUtils::friendlyFileSize(2 * pow(1024, $i)), '2' . $units[$i]);
     }
     $this->assertEquals(TextUtils::friendlyFileSize(2 * pow(1024, 6)), '2048' . $units[5]);
 }
 public static function friendlyFileSize($size, $precision = 2)
 {
     if ($size < 1024) {
         return $size . ' ' . self::selectCaseForNumber($size, array('байт', 'байта', 'байт'));
     } else {
         return TextUtils::friendlyFileSize($size, $precision, self::$bytePrefixes, true) . 'Б';
     }
 }