mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-24 10:06:08 +02:00
Add scalar types to processor/formatters and top level classes
This commit is contained in:
@@ -32,22 +32,20 @@ abstract class MemoryProcessor
|
||||
* @param bool $realUsage Set this to true to get the real size of memory allocated from system.
|
||||
* @param bool $useFormatting If true, then format memory size to human readable string (MB, KB, B depending on size)
|
||||
*/
|
||||
public function __construct($realUsage = true, $useFormatting = true)
|
||||
public function __construct(bool $realUsage = true, bool $useFormatting = true)
|
||||
{
|
||||
$this->realUsage = (boolean) $realUsage;
|
||||
$this->useFormatting = (boolean) $useFormatting;
|
||||
$this->realUsage = $realUsage;
|
||||
$this->useFormatting = $useFormatting;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is
|
||||
*
|
||||
* @param int $bytes
|
||||
* @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as is
|
||||
* @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as int
|
||||
*/
|
||||
protected function formatBytes($bytes)
|
||||
protected function formatBytes(int $bytes)
|
||||
{
|
||||
$bytes = (int) $bytes;
|
||||
|
||||
if (!$this->useFormatting) {
|
||||
return $bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user