Completed
Pull Request — master (#20)
by
unknown
06:45
created

Variables::getDateFormat()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php namespace VojtaSvoboda\Reservations\Classes;
2
3
use Config;
4
use VojtaSvoboda\Reservations\Models\Settings;
5
6
class Variables
7
{
8
    public static function getDateTimeFormat()
9
    {
10
        return self::getDateFormat().' '.self::getTimeFormat();
11
    }
12
13
    public static function getDateFormat()
14
    {
15
        $default = Config::get('vojtasvoboda.reservations::config.formats.date', 'd/m/Y');
16
17
        return Settings::get('formats_date', $default);
18
    }
19
20
    public static function getTimeFormat()
21
    {
22
        $default = Config::get('vojtasvoboda.reservations::config.formats.time', 'H:i');
23
24
        return Settings::get('formats_time', $default);
25
    }
26
27
    public static function getReservationInterval()
28
    {
29
        $default = Config::get('vojtasvoboda.reservations::config.reservation.interval', 15);
30
31
        return (int) Settings::get('reservation_interval', $default);
32
    }
33
34
    public static function getReservationLength()
35
    {
36
        $default = Config::get('vojtasvoboda.reservations::config.reservation.length', '2 hours');
37
38
        $length = Settings::get('reservation_length');
39
        $unit = Settings::get('reservation_length_unit');
40
41
        if (empty($length) || empty($unit)) {
42
            return $default;
43
        }
44
45
        return $length . ' ' . $unit;
46
    }
47
48
    public static function getWorkingDays()
49
    {
50
        $default = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'];
51
52
        return Settings::get('work_days', $default);
53
    }
54
55
    public static function getFirstWeekday()
56
    {
57
        return (int) Settings::get('first_weekday', false);
58
    }
59
60
    public static function getWorkTimeFrom()
61
    {
62
        return Settings::get('work_time_from', '10:00');
63
    }
64
65
    public static function getWorkTimeTo()
66
    {
67
        return Settings::get('work_time_to', '18:00');
68
    }
69
}
70