Passed
Pull Request — master (#20)
by Vojta
06:40
created

Variables::getWorkTimeFrom()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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 = (int) Config::get('vojtasvoboda.reservations::config.reservation.length', 2);
37
38
        return Settings::get('reservation_length', $default) . ' hours';
39
    }
40
41
    public static function getWorkingDays()
42
    {
43
        $default = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'];
44
45
        return Settings::get('work_days', $default);
46
    }
47
48
    public static function getFirstWeekday()
49
    {
50
        return (int) Settings::get('first_weekday', false);
51
    }
52
53
    public static function getWorkTimeFrom()
54
    {
55
        return Settings::get('work_time_from', '10:00');
56
    }
57
58
    public static function getWorkTimeTo()
59
    {
60
        return Settings::get('work_time_to', '18:00');
61
    }
62
}
63