Passed
Push — main ( be1355...6c0d46 )
by PRATIK
02:24 queued 12s
created

nepaliDate()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
c 0
b 0
f 0
dl 0
loc 11
rs 9.9666
cc 4
nc 4
nop 1
1
<?php
2
3
use Carbon\Carbon;
4
use Pratiksh\Nepalidate\Facades\NepaliDate;
5
6
if (!function_exists('nepaliDate')) {
7
    function nepaliDate(Carbon $date)
8
    {
9
        $mode = config('nepalidate.mode', 1);
10
        if ($mode == 1) {
11
            return toBS($date);
12
        } elseif ($mode == 2) {
13
            return toFormattedBSDate($date);
14
        } elseif ($mode == 3) {
15
            return toFormattedNepaliDate($date);
16
        } else {
17
            return toBS($date);
18
        }
19
    }
20
}
21
22
if (!function_exists('toBS')) {
23
    function toBS(Carbon $date)
24
    {
25
        return NepaliDate::create($date)->toBS();
0 ignored issues
show
Bug introduced by
The method create() does not exist on Pratiksh\Nepalidate\Facades\NepaliDate. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
        return NepaliDate::/** @scrutinizer ignore-call */ create($date)->toBS();
Loading history...
26
    }
27
}
28
29
if (!function_exists('toFormattedBSDate')) {
30
    function toFormattedBSDate(Carbon $date)
31
    {
32
        return NepaliDate::create($date)->toFormattedBSDate();
33
    }
34
}
35
36
if (!function_exists('toFormattedNepaliDate')) {
37
    function toFormattedNepaliDate(Carbon $date)
38
    {
39
        return NepaliDate::create($date)->toFormattedNepaliDate();
40
    }
41
}
42