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

MemoryUsage   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 20
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A now() 0 4 1
A __toString() 0 4 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