Completed
Push — master ( 975c17...8f2777 )
by Adam
04:20 queued 01:49
created

MemoryUsage::now()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace BestServedCold\PhalueObjects\Metric;
4
5
use BestServedCold\PhalueObjects\Format\Byte\Binary;
6
use BestServedCold\PhalueObjects\Mathematical\Operator\ArithmeticTrait;
7
use BestServedCold\PhalueObjects\Metric;
8
9
/**
10
 * Class MemoryUsage
11
 *
12
 * @package BestServedCold\PhalueObjects\Metric
13
 */
14
class MemoryUsage extends Metric implements MetricInterface
15
{
16
    use ArithmeticTrait;
17
18
    /**
19
     * @return static
20
     */
21 2
    public static function now()
22
    {
23 2
        return new static(memory_get_usage());
24
    }
25
26
    /**
27
     * @return string
28
     */
29 1
    public function __toString()
30
    {
31 1
        return (string) Binary::fromBytes($this->getValue());
32
    }
33
}
34