PluginProbe
ManageWP Worker / 4.9.25
ManageWP Worker v4.9.25
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / src / Monolog / Processor / MemoryProcessor.php

MemoryProcessor.php in ManageWP Worker 4.9.25, at src/Monolog/Processor/MemoryProcessor.php

49 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 /**
13 * Some methods that are common for all memory processors
14 *
15 * @author Rob Jensen
16 */
17 abstract class Monolog_Processor_MemoryProcessor implements Monolog_Processor_ProcessorInterface
18 {
19 protected $realUsage;
20
21 /**
22 * @param boolean $realUsage
23 */
24 public function __construct($realUsage = true)
25 {
26 $this->realUsage = (boolean) $realUsage;
27 }
28
29 /**
30 * Formats bytes into a human readable string
31 *
32 * @param int $bytes
33 *
34 * @return string
35 */
36 protected static function formatBytes($bytes)
37 {
38 $bytes = (int) $bytes;
39
40 if ($bytes > 1024 * 1024) {
41 return round($bytes / 1024 / 1024, 2).' MB';
42 } elseif ($bytes > 1024) {
43 return round($bytes / 1024, 2).' KB';
44 }
45
46 return $bytes.' B';
47 }
48 }
49