Completed
Push — master ( 799de4...6f590f )
by Aitor
10s
created

loadTasks::taskServiceStop()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 3
crap 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
 *
8
 * @author      Polyvaniy Oleksii (alexndlm) <[email protected]>
9
 * @copyright   2016 Polyvaniy Oleksii (alexndlm) <[email protected]>
10
 *
11
 * @license     MIT
12
 */
13
14
namespace Falc\Robo\Service;
15
16
use Falc\Robo\Service\Factory\CommandBuilderFactoryInterface;
17
18
/**
19
 * Loads tasks.
20
 */
21
trait loadTasks
22
{
23
    /**
24
     * Allows to start a service.
25
     *
26
     * @param   string                         $serviceManager Service manager to use. Optional.
27
     * @param   string                         $service        Service. Optional.
28
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
29
     *
30
     * @return Start
31
     */
32 6
    protected function taskServiceStart($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
33
    {
34 6
        return new Start($serviceManager, $service, $factory);
35
    }
36
37
    /**
38
     * Allows to stop a service.
39
     *
40
     * @param   string                         $serviceManager Service manager to use. Optional.
41
     * @param   string                         $service        Service. Optional.
42
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
43
     *
44
     * @return Stop
45
     */
46 6
    protected function taskServiceStop($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
47
    {
48 6
        return new Stop($serviceManager, $service, $factory);
49
    }
50
51
    /**
52
     * Allows to restart a service.
53
     *
54
     * @param   string                         $serviceManager Service manager to use. Optional.
55
     * @param   string                         $service        Service. Optional.
56
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
57
     *
58
     * @return Restart
59
     */
60 6
    protected function taskServiceRestart($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
61
    {
62 6
        return new Restart($serviceManager, $service, $factory);
63
    }
64
65
    /**
66
     * Allows to reload a service.
67
     *
68
     * @param   string                         $serviceManager Service manager to use. Optional.
69
     * @param   string                         $service        Service. Optional.
70
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
71
     *
72
     * @return Reload
73
     */
74 6
    protected function taskServiceReload($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
75
    {
76 6
        return new Reload($serviceManager, $service, $factory);
77
    }
78
79
    /**
80
     * Allows to enable a service.
81
     *
82
     * @param   string                         $serviceManager Service manager to use. Optional.
83
     * @param   string                         $service        Service. Optional.
84
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
85
     *
86
     * @return Enable
87
     */
88 6
    protected function taskServiceEnable($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
89
    {
90 6
        return new Enable($serviceManager, $service, $factory);
91
    }
92
93
    /**
94
     * Allows to disable a service.
95
     *
96
     * @param   string                         $serviceManager Service manager to use. Optional.
97
     * @param   string                         $service        Service. Optional.
98
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
99
     *
100
     * @return Disable
101
     */
102 6
    protected function taskServiceDisable($serviceManager = null, $service = null, CommandBuilderFactoryInterface $factory = null)
103
    {
104 6
        return new Disable($serviceManager, $service, $factory);
105
    }
106
107
    /**
108
     * Allows to reload systemd manager configuration.
109
     *
110
     * @param   string                         $serviceManager Service manager to use. Optional.
111
     * @param   CommandBuilderFactoryInterface $factory        CommandBuilder factory. Optional.
112
     *
113
     * @return DaemonReload
114
     */
115 5
    protected function taskServiceDaemonReload($serviceManager = null, CommandBuilderFactoryInterface $factory = null)
116
    {
117 5
        return new DaemonReload($serviceManager, $factory);
118
    }
119
}
120