Completed
Push — master ( e2c5a9...852a9e )
by Petrică
02:20
created

MemoryUsedGauge   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 25
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPath() 0 4 1
A getValue() 0 11 3
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Petrica
5
 * Date: 3/24/2016
6
 * Time: 1:17
7
 */
8
namespace Petrica\StatsdSystem\Gauge;
9
10
class MemoryUsedGauge extends AbstractMemoryGauge
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function getPath()
16
    {
17
        return 'memory.used.value';
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function getValue()
24
    {
25
        $info = $this->getSystemMemoryInfo();
26
27
        if (isset($info['MemFree'])
28
            && isset($info['MemTotal'])) {
29
            return $info['MemTotal'] - $info['MemFree'];
30
        }
31
32
        return false;
33
    }
34
}