Completed
Push — master ( 8fb2e6...4c10a9 )
by Shcherbak
02:16
created

CronTaskInfo::getTimeExpression()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
  namespace Funivan\Console\CommandCron;
4
5
  use Symfony\Component\Console\Command\Command;
6
7
8
  /**
9
   * @author Ivan Shcherbak <[email protected]>
10
   */
11
  class CronTaskInfo {
12
13
    /**
14
     * @var string
15
     */
16
    protected $timeExpression;
17
18
    /**
19
     * @var Command
20
     */
21
    protected $command;
22
23
    /**
24
     * @var string
25
     */
26
    protected $arguments;
27
28
29
    /**
30
     *
31
     * @param string $timeExpression
32
     * @param Command $command
33
     * @param string $arguments
34
     */
35 1
    public function __construct($timeExpression, Command $command, $arguments = '') {
36 1
      $this->timeExpression = $timeExpression;
37 1
      $this->command = $command;
38 1
      $this->arguments = $arguments;
39 1
    }
40
41
42
    /**
43
     * @throws \InvalidArgumentException if not a valid CRON expression
44
     * @return \Cron\CronExpression
45
     */
46 1
    public function getCronObject() {
47 1
      return \Cron\CronExpression::factory($this->timeExpression);
48
    }
49
50
51
    /**
52
     * @return string
53
     */
54 1
    public function getTimeExpression() {
55 1
      return $this->timeExpression;
56
    }
57
58
59
    /**
60
     * @return Command
61
     */
62
    public function getCommand() {
63
      return $this->command;
64
    }
65
66
67
    /**
68
     * @return string
69
     */
70 1
    public function getArguments() {
71 1
      return $this->arguments;
72
    }
73
74
75
  }