PSR12 code standard.
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -8,9 +8,9 @@ use Twig\TwigFilter;
|
||||
|
||||
/**
|
||||
* Twig extension
|
||||
*
|
||||
*
|
||||
* Additional formatters for templates
|
||||
*
|
||||
*
|
||||
* @author Jens True <jens.chr.true@gmail.com>
|
||||
* @license https://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
* @link https://jcktrue.dk
|
||||
@@ -19,10 +19,10 @@ class AppExtension extends AbstractExtension
|
||||
{
|
||||
/**
|
||||
* Extend the filters
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return TwigFilter[]
|
||||
*/
|
||||
public function getFilters() : array
|
||||
public function getFilters(): array
|
||||
{
|
||||
return array(
|
||||
new TwigFilter('formatBytes', array($this, 'formatBytes')),
|
||||
@@ -31,10 +31,10 @@ class AppExtension extends AbstractExtension
|
||||
|
||||
/**
|
||||
* Format a file size to be human readable
|
||||
*
|
||||
*
|
||||
* @param int $bytes Number of bytes
|
||||
* @param int $precision Precision
|
||||
*
|
||||
*
|
||||
* @return string Formatted string
|
||||
*/
|
||||
public function formatBytes($bytes, $precision = 2)
|
||||
@@ -43,5 +43,4 @@ class AppExtension extends AbstractExtension
|
||||
$fact = (int)(floor((strlen((string)$bytes) - 1) / 3));
|
||||
return sprintf("%.{$precision}f", $bytes / pow(1024, $fact)) . $size[$fact];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user