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

CronTaskInfo   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 84.62%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 65
ccs 11
cts 13
cp 0.8462
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getCronObject() 0 3 1
A getTimeExpression() 0 3 1
A getCommand() 0 3 1
A getArguments() 0 3 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
  }