AnnotationLineConfigurator   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 2
dl 0
loc 40
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
C configureFrom() 0 29 9
1
<?php
2
3
namespace MyBuilder\Bundle\CronosBundle\Exporter;
4
5
use MyBuilder\Bundle\CronosBundle\Annotation\Cron as CronAnnotation;
6
use MyBuilder\Cronos\Formatter\Job;
7
8
class AnnotationLineConfigurator
9
{
10
    /** @var Job */
11
    private $line;
12
13
    public function __construct(Job $line)
14
    {
15
        $this->line = $line;
16
    }
17
18
    public function configureFrom(CronAnnotation $annotation): Job
19
    {
20
        if ($annotation->minute !== null) {
21
            $this->line->setMinute($annotation->minute);
22
        }
23
        if ($annotation->hour !== null) {
24
            $this->line->setHour($annotation->hour);
25
        }
26
        if ($annotation->dayOfMonth !== null) {
27
            $this->line->setDayOfMonth($annotation->dayOfMonth);
28
        }
29
        if ($annotation->month !== null) {
30
            $this->line->setMonth($annotation->month);
31
        }
32
        if ($annotation->dayOfWeek !== null) {
33
            $this->line->setDayOfWeek($annotation->dayOfWeek);
34
        }
35
        if ($annotation->logFile !== null) {
36
            $this->line->setStandardOutFile($annotation->logFile);
37
        }
38
        if ($annotation->errorFile !== null) {
39
            $this->line->setStandardErrorFile($annotation->errorFile);
40
        }
41
        if ($annotation->noLogs !== null) {
42
            $this->line->suppressOutput();
43
        }
44
45
        return $this->line;
46
    }
47
}
48