Result   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 20
c 1
b 0
f 0
dl 0
loc 68
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getSchedule() 0 6 2
1
<?php
2
3
/**
4
 * This file is part of SebastianFeldmann\Crontab.
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace SebastianFeldmann\Crontab\Parser;
13
14
/**
15
 * Class Result
16
 *
17
 * @package SebastianFeldmann\Crontab
18
 * @author  Sebastian Feldmann <[email protected]>
19
 * @link    https://github.com/sebastianfeldmann/crontab
20
 * @since   Class available since Release 0.9.0
21
 */
22
class Result
23
{
24
    /**
25
     * @var string
26
     */
27
    public $min;
28
29
    /**
30
     * @var string
31
     */
32
    public $hour;
33
34
    /**
35
     * @var string
36
     */
37
    public $day;
38
39
    /**
40
     * @var string
41
     */
42
    public $month;
43
44
    /**
45
     * @var string
46
     */
47
    public $dayOfWeek;
48
49
    /**
50
     * @var string
51
     */
52
    public $year;
53
54
    /**
55
     * @var string
56
     */
57
    public $user;
58
59
    /**
60
     * @var string
61
     */
62
    public $command;
63
64
    /**
65
     * Result constructor.
66
     */
67
    public function __construct()
68
    {
69
        $this->min       = '';
70
        $this->hour      = '';
71
        $this->day       = '';
72
        $this->month     = '';
73
        $this->dayOfWeek = '';
74
        $this->year      = '';
75
        $this->user      = '';
76
        $this->command   = '';
77
    }
78
79
    /**
80
     * Return cron expression.
81
     *
82
     * @return string
83
     */
84
    public function getSchedule(): string
85
    {
86
        $schedule  = $this->min . ' ' . $this->hour . ' ' . $this->day . ' ' . $this->month . ' ' . $this->dayOfWeek;
87
        $schedule .= !empty($this->year) ? ' ' . $this->year : '';
88
89
        return $schedule;
90
    }
91
}
92