@@ -80,7 +80,7 @@ |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | - * @param $name |
|
83 | + * @param boolean|string $name |
|
84 | 84 | */ |
85 | 85 | private static function stopMarkers($name) |
86 | 86 | { |
@@ -46,7 +46,7 @@ |
||
46 | 46 | public static function human($name = false) |
47 | 47 | { |
48 | 48 | return implode(array_map(function ($key, $value) { |
49 | - return '[' . $key . ']: [' . (string) $value . "]\n"; |
|
49 | + return '[' . $key . ']: [' . (string) $value . "]\n"; |
|
50 | 50 | }, array_keys(self::get($name)), self::get($name))); |
51 | 51 | } |
52 | 52 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * @var array |
20 | 20 | */ |
21 | - protected static $markers = []; |
|
21 | + protected static $markers = [ ]; |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * @var string |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | /** |
29 | 29 | * @var array |
30 | 30 | */ |
31 | - protected static $metrics = [ |
|
31 | + protected static $metrics = [ |
|
32 | 32 | MicroTime::class, |
33 | 33 | MemoryUsage::class, |
34 | 34 | DeclaredInterface::class, |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function human($name = false) |
47 | 47 | { |
48 | - return implode(array_map(function ($key, $value) { |
|
49 | - return '[' . $key . ']: [' . (string) $value . "]\n"; |
|
48 | + return implode(array_map(function($key, $value) { |
|
49 | + return '['.$key.']: ['.(string) $value."]\n"; |
|
50 | 50 | }, array_keys(self::get($name)), self::get($name))); |
51 | 51 | } |
52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public static function get($name = false) |
58 | 58 | { |
59 | - return $name ? self::$markers[$name] : self::$markers; |
|
59 | + return $name ? self::$markers[ $name ] : self::$markers; |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | /** @var Metric $metric */ |
68 | 68 | foreach (self::$metrics as $metric) { |
69 | 69 | $now = $metric::now(); |
70 | - self::$markers[self::getName($name)][$now->getShortName()] = $now; |
|
70 | + self::$markers[ self::getName($name) ][ $now->getShortName() ] = $now; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | private static function stopMarkers($name) |
86 | 86 | { |
87 | 87 | /** @var Metric $metric */ |
88 | - foreach (self::$markers[$name] as $metric) { |
|
89 | - self::$markers[$name][$metric->getShortName()] = $metric::now()->diff($metric); |
|
88 | + foreach (self::$markers[ $name ] as $metric) { |
|
89 | + self::$markers[ $name ][ $metric->getShortName() ] = $metric::now()->diff($metric); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | self::addPeak($name); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | private static function addPeak($name) |
99 | 99 | { |
100 | 100 | $peak = PeakMemoryUsage::now(); |
101 | - self::$markers[$name][$peak->getShortName()] = $peak; |
|
101 | + self::$markers[ $name ][ $peak->getShortName() ] = $peak; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -2,8 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace BestServedCold\PhalueObjects; |
4 | 4 | |
5 | -use phpDocumentor\Compiler\Pass\PackageTreeBuilder; |
|
6 | - |
|
7 | 5 | /** |
8 | 6 | * Class ValueObject |
9 | 7 | * |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | |
7 | 7 | abstract class Byte extends ValueObject |
8 | 8 | { |
9 | - private $units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; |
|
9 | + private $units = [ "Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" ]; |
|
10 | 10 | protected $power; |
11 | 11 | |
12 | 12 | public static function fromBytes($bytes) |
@@ -34,6 +34,6 @@ discard block |
||
34 | 34 | |
35 | 35 | public function __toString() |
36 | 36 | { |
37 | - return $this->getValue() ? $this->power() . ' ' . $this->getUnit() : '0 bytes'; |
|
37 | + return $this->getValue() ? $this->power().' '.$this->getUnit() : '0 bytes'; |
|
38 | 38 | } |
39 | 39 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | parent::__construct($value); |
26 | 26 | |
27 | - if (! $this->getValue()->isArray()) { |
|
27 | + if (!$this->getValue()->isArray()) { |
|
28 | 28 | throw new InvalidTypeException($value, [ 'array' ]); |
29 | 29 | } |
30 | 30 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | |
32 | 32 | public function arrayToPairString(array $array) |
33 | 33 | { |
34 | - return implode(',', array_map(function ($key, $value) { |
|
35 | - return $key . '=' . $value; |
|
34 | + return implode(',', array_map(function($key, $value) { |
|
35 | + return $key.'='.$value; |
|
36 | 36 | }, array_keys($array), $array)); |
37 | 37 | } |
38 | 38 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function nullIfNotSet(array $array, $key = false) |
86 | 86 | { |
87 | - return isset($array[$key]) ? $array[$key] : null; |
|
87 | + return isset($array[ $key ]) ? $array[ $key ] : null; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -94,6 +94,6 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public static function falseIfNotSet(array $array, $key = false) |
96 | 96 | { |
97 | - return isset($array[$key]) ? $array[$key] : false; |
|
97 | + return isset($array[ $key ]) ? $array[ $key ] : false; |
|
98 | 98 | } |
99 | 99 | } |
@@ -16,6 +16,6 @@ |
||
16 | 16 | */ |
17 | 17 | public static function now() |
18 | 18 | { |
19 | - return new static(get_defined_functions()['user']); |
|
19 | + return new static(get_defined_functions()[ 'user' ]); |
|
20 | 20 | } |
21 | 21 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public static function now() |
21 | 21 | { |
22 | - return new static(get_defined_constants(true)['user']); |
|
22 | + return new static(get_defined_constants(true)[ 'user' ]); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -28,6 +28,6 @@ |
||
28 | 28 | public function __toString() |
29 | 29 | { |
30 | 30 | list($sec, $fine) = explode('.', $this->getValue()); |
31 | - return date('H:i:s', $sec) . ':' . preg_replace('/0\./', '.', $fine); |
|
31 | + return date('H:i:s', $sec).':'.preg_replace('/0\./', '.', $fine); |
|
32 | 32 | } |
33 | 33 | } |