toFormattedEnglishBSDate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
use Carbon\Carbon;
4
use Pratiksh\Nepalidate\Services\EnglishDate;
5
use Pratiksh\Nepalidate\Services\NepaliDate;
6
7
if (! function_exists('toFormattedBSDate')) {
8
    function toFormattedBSDate(Carbon $date)
9
    {
10
        return NepaliDate::create($date)->toFormattedEnglishBSDate();
11
    }
12
}
13
14
if (! function_exists('toFormattedNepaliDate')) {
15
    function toFormattedNepaliDate(Carbon $date)
16
    {
17
        return NepaliDate::create($date)->toFormattedNepaliBSDate();
18
    }
19
}
20
21
if (! function_exists('toAD')) {
22
    function toAD(string $date)
23
    {
24
        return EnglishDate::create($date)->toCarbon();
25
    }
26
}
27
28
if (! function_exists('toBS')) {
29
    function toBS(Carbon $date)
30
    {
31
        return NepaliDate::create($date)->toBS();
32
    }
33
}
34
35
if (! function_exists('toFormattedEnglishBSDate')) {
36
    function toFormattedEnglishBSDate(Carbon $date)
37
    {
38
        return NepaliDate::create($date)->toFormattedEnglishBSDate();
39
    }
40
}
41
42
if (! function_exists('toFormattedNepaliBSDate')) {
43
    function toFormattedNepaliBSDate(Carbon $date)
44
    {
45
        return NepaliDate::create($date)->toFormattedNepaliBSDate();
46
    }
47
}
48
49
if (! function_exists('toDetailBS')) {
50
    function toDetailBS(Carbon $date)
51
    {
52
        $bs_array = NepaliDate::create($date)->toBSArray();
53
        $to_detail_bs = null;
54
55
        if (! empty($bs_array) && is_array($bs_array)) {
56
            $json = json_encode($bs_array);
57
            if ($json !== false) {
58
                $to_detail_bs = json_decode($json);
59
            }
60
        }
61
62
        return $to_detail_bs;
63
    }
64
}
65