2 code examples of PHP Plank\Mediable\Helpers\File extracted from open source projects
/**
* Generate the model's filename.
*/
private function generateFilename(): string
{
if ($this->filename) {
return $this->filename;
}
if ($this->hashFilename) {
return $this->generateHash();
}
return File::sanitizeFileName($this->source->filename());
}
/**
* Calculate the file size in human readable byte notation.
* @param int $precision (_optional_) Number of decimal places to include
*/
public function readableSize(int $precision = 1): string
{
return File::readableSize($this->size, $precision);
}