CronTaskInfo   A
last analyzed

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 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
  }