TasksRequestTrait::setMaxtime()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php namespace Comodojo\Extender\Traits;
2
3
use \Comodojo\Extender\Utils\Validator;
4
5
/**
6
 * @package     Comodojo Extender
7
 * @author      Marco Giovinazzi <[email protected]>
8
 * @license     MIT
9
 *
10
 * LICENSE:
11
 *
12
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18
 * THE SOFTWARE.
19
 */
20
21
trait TasksRequestTrait {
22
23
    /**
24
     * @var string
25
     */
26
    protected $name;
27
28
    /**
29
     * @var string
30
     */
31
    protected $task;
32
33
    /**
34
     * @var int
35
     */
36
    protected $niceness = 0;
37
38
    /**
39
     * @var int
40
     */
41
    protected $maxtime = 600;
42
43
    /**
44
     * Get request name
45
     *
46
     * @return string
47
     */
48
    public function getName() {
49
50
        return $this->name;
51
52
    }
53
54
    public function setName($name) {
55
56
        $this->name = $name;
57
58
        return $this;
59
60
    }
61
62
    /**
63
     * Get request associated task
64
     *
65
     * @return string
66
     */
67
    public function getTask() {
68
69
        return $this->task;
70
71
    }
72
73
    public function setTask($task) {
74
75
        $this->task = $task;
76
77
        return $this;
78
79
    }
80
81
    /**
82
     * Get requested niceness (-20/20)
83
     *
84
     * @return int
85
     */
86
    public function getNiceness() {
87
88
        return $this->niceness;
89
90
    }
91
92
    public function setNiceness($niceness) {
93
94
        $this->niceness = Validator::niceness($niceness);
95
96
        return $this;
97
98
    }
99
100
    /**
101
     * Get max allowed execution time
102
     *
103
     * @return int
104
     */
105
    public function getMaxtime() {
106
107
        return $this->maxtime;
108
109
    }
110
111
    public function setMaxtime($maxtime) {
112
113
        $this->maxtime = Validator::maxChildRuntime($maxtime);
114
115
        return $this;
116
117
    }
118
119
}
120