Completed
Push — master ( 3bdd73...3b96a7 )
by Ankit
02:28
created

Time   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B timeConversion() 0 14 5
1
<?php
2
3
namespace ChatApp;
4
5
/**
6
* For the conversion of time
7
*/
8
class Time
9
{
10
11
    public function __construct()
12
    {
13
        # code...
14
    }
15
16
    public function timeConversion($time)
17
    {
18
19
        if(substr($time,4,11) == date("d M Y", time() + 16200))
20
            $time = substr($time,16,5);
21
        else if(substr($time,7,8) == date("M Y", time() + 16200) && substr($time, 4,2) - date("d") < 7)
22
            $time = substr($time,0,3);
23
        else if(substr($time,11,4) == date("Y", time() + 16200))
24
            $time = substr($time,4,6);
25
        else
26
            $time = substr($time,4,11);
27
28
        return $time;
29
    }
30
}