CronTaskInfo::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

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