private function BackupMigrateDropboxAPI::byte_size in Backup and Migrate Dropbox 7.2
Same name and namespace in other branches
- 7.3 backup_migrate_dropbox.dropbox_api.inc \BackupMigrateDropboxAPI::byte_size()
1 call to BackupMigrateDropboxAPI::byte_size()
- BackupMigrateDropboxAPI::file_upload in ./
backup_migrate_dropbox.dropbox_api.inc - Uploads a file to the given path.
File
- ./
backup_migrate_dropbox.dropbox_api.inc, line 414 - backup_migrate_dropbox.api.inc
Class
- BackupMigrateDropboxAPI
- @file backup_migrate_dropbox.api.inc
Code
private function byte_size($byteString) {
preg_match('/^\\s*([0-9.]+)\\s*([KMGT])B?\\s*$/i', $byteString, $matches);
if (!(count($matches) >= 3)) {
return 0;
}
$num = (double) $matches[1];
switch (strtoupper($matches[2])) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'T':
$num *= DRUPAL_KILOBYTE;
/** @noinspection PhpMissingBreakStatementInspection */
case 'G':
$num *= DRUPAL_KILOBYTE;
/** @noinspection PhpMissingBreakStatementInspection */
case 'M':
$num *= DRUPAL_KILOBYTE;
case 'K':
$num *= DRUPAL_KILOBYTE;
}
return intval($num);
}