Test Setup Failed
Push — test ( 228c06...2056fb )
by Jonathan
03:19
created

MicrotimeRepresentation   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 21 2
A getDateTime() 0 4 1
1
<?php
2
3
namespace Kint\Object\Representation;
4
5
use DateTime;
6
7
class MicrotimeRepresentation extends Representation
0 ignored issues
show
Coding Style introduced by
The property $mem_real is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $mem_peak is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
Coding Style introduced by
The property $mem_peak_real is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
8
{
9
    public $seconds = null;
10
    public $microseconds = null;
11
    public $group = null;
12
    public $lap = null;
13
    public $total = null;
14
    public $avg = null;
15
    public $i = 0;
16
    public $mem = 0;
17
    public $mem_real = 0;
0 ignored issues
show
Coding Style introduced by
$mem_real does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
18
    public $mem_peak = null;
0 ignored issues
show
Coding Style introduced by
$mem_peak does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
19
    public $mem_peak_real = null;
0 ignored issues
show
Coding Style introduced by
$mem_peak_real does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
20
    public $hints = array('microtime');
21
22
    public function __construct($seconds, $microseconds, $group, $lap = null, $total = null, $i = 0)
23
    {
24
        parent::__construct('Microtime');
25
26
        $this->seconds = (int) $seconds;
27
        $this->microseconds = (int) $microseconds;
28
29
        $this->group = $group;
30
        $this->lap = $lap;
31
        $this->total = $total;
32
        $this->i = $i;
33
34
        if ($i) {
35
            $this->avg = $total / $i;
36
        }
37
38
        $this->mem = memory_get_usage();
39
        $this->mem_real = memory_get_usage(true);
40
        $this->mem_peak = memory_get_peak_usage();
41
        $this->mem_peak_real = memory_get_peak_usage(true);
42
    }
43
44
    public function getDateTime()
45
    {
46
        return DateTime::createFromFormat('U u', $this->seconds.' '.str_pad($this->microseconds, 6, '0', STR_PAD_LEFT));
47
    }
48
}
49