Completed
Pull Request — master (#1)
by
unknown
05:54
created

loadTasks   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 6
dl 0
loc 85
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A taskServiceStart() 0 4 1
A taskServiceStop() 0 4 1
A taskServiceRestart() 0 4 1
A taskServiceEnable() 0 4 1
A taskServiceDisable() 0 4 1
A taskServiceDaemonReload() 0 4 1
1
<?php
2
/**
3
 * This file is part of RoboSystemService.
4
 *
5
 * @author      Aitor García Martínez (Falc) <[email protected]>
6
 * @copyright   2015 Aitor García Martínez (Falc) <[email protected]>
7
 * @license     MIT
8
 */
9
10
namespace Falc\Robo\Service;
11
12
use Falc\Robo\Service\Factory\CommandBuilderFactoryInterface;
13
14
/**
15
 * Loads tasks.
16
 */
17
trait loadTasks
18
{
19
    /**
20
     * Allows to start a service.
21
     *
22
     * @param   string                         $serviceManager Service manager to use. Optional.
23
     * @param   string                         $service        Service. Optional.
24
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
25
     *
26
     * @return Start
27
     */
28 6
    protected function taskServiceStart($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
29
    {
30 6
        return new Start($serviceManager, $service, $factory);
31
    }
32
33
    /**
34
     * Allows to stop a service.
35
     *
36
     * @param   string                         $serviceManager Service manager to use. Optional.
37
     * @param   string                         $service        Service. Optional.
38
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
39
     *
40
     * @return Stop
41
     */
42 6
    protected function taskServiceStop($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
43
    {
44 6
        return new Stop($serviceManager, $service, $factory);
45
    }
46
47
    /**
48
     * Allows to restart a service.
49
     *
50
     * @param   string                         $serviceManager Service manager to use. Optional.
51
     * @param   string                         $service        Service. Optional.
52
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
53
     *
54
     * @return Restart
55
     */
56 6
    protected function taskServiceRestart($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
57
    {
58 6
        return new Restart($serviceManager, $service, $factory);
59
    }
60
61
    /**
62
     * Allows to enable a service.
63
     *
64
     * @param   string                         $serviceManager Service manager to use. Optional.
65
     * @param   string                         $service        Service. Optional.
66
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
67
     *
68
     * @return Enable
69
     */
70 6
    protected function taskServiceEnable($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
71
    {
72 6
        return new Enable($serviceManager, $service, $factory);
73
    }
74
75
    /**
76
     * Allows to disable a service.
77
     *
78
     * @param   string                         $serviceManager Service manager to use. Optional.
79
     * @param   string                         $service        Service. Optional.
80
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
81
     *
82
     * @return Disable
83
     */
84 6
    protected function taskServiceDisable($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
85
    {
86 6
        return new Disable($serviceManager, $service, $factory);
87
    }
88
89
    /**
90
     * Allows to reload systemd manager configuration.
91
     *
92
     * @param   string                         $serviceManager Service manager to use. Optional.
93
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
94
     *
95
     * @return DaemonReload
96
     */
97 5
    protected function taskServiceDaemonReload($serviceManager = null, CommandBuilderFactoryInterface $factory = null)
98
    {
99 5
        return new DaemonReload($serviceManager, $factory);
100
    }
101
}
102