Completed
Push — development ( c87275...b28f77 )
by Ashutosh
11:48
created

checkArray()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 2
1
<?php
2
3
function checkArray($key, $array)
4
{
5
    $value = '';
6
    if (is_array($array) && array_key_exists($key, $array)) {
7
        $value = $array[$key];
8
    }
9
10
    return $value;
11
}
12
13
function mime($type)
14
{
15
    if ($type == 'jpg' ||
16
            $type == 'png' ||
17
            $type == 'jpeg' ||
18
            $type == 'gif' ||
19
            starts_with($type, 'image')) {
20
        return 'image';
21
    }
22
}
23
24
function isInstall()
25
{
26
    $check = false;
27
    $env = base_path('.env');
28
    if (\File::exists($env) && env('DB_INSTALL') == 1) {
29
        $check = true;
30
    }
31
32
    return $check;
33
}
34
35
function agoratime($date, $hour = 0, $min = 0, $sec = 0, $tz = '')
36
{
37
    if (is_bool($hour) && $hour === true) {
38
        $hour = $date->hour;
39
    }
40
    if (is_bool($min) && $min === true) {
41
        $min = $date->minute;
42
    }
43
    if (is_bool($sec) && $sec === true) {
44
        $sec = $date->second;
45
    }
46
    if (!$tz) {
47
        $tz = /* @scrutinizer ignore-call */ timezone();
48
    }
49
    $date1 = \Carbon\Carbon::create($date->year, $date->month, $date->day, $hour, $min, $sec, $tz);
50
51
    return $date1->hour($hour)->minute($min)->second($sec);
52
}
53