Completed
Push — master ( c5ed18...ed0fce )
by Nathan
07:36
created

QueuedJobRule::getMaximumSiblingProcessorUsage()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Symbiote\QueuedJobs\DataObjects;
4
5
use AsyncPHP\Doorman\Rule;
6
use SilverStripe\ORM\DataObject;
7
8
/**
9
 * @property int $Processes
10
 * @property string $Handler
11
 * @property float $MinimumProcessorUsage
12
 * @property float $MaximumProcessorUsage
13
 * @property float $MinimumMemoryUsage
14
 * @property float $MaximumMemoryUsage
15
 * @property float $MinimumSiblingProcessorUsage
16
 * @property float $MaximumSiblingProcessorUsage
17
 * @property float $MinimumSiblingMemoryUsage
18
 * @property float $MaximumSiblingMemoryUsage
19
 */
20
class QueuedJobRule extends DataObject implements Rule
21
{
22
    /**
23
     * {@inheritDoc}
24
     * @var string
25
     */
26
    private static $table_name = 'QueuedJobRule';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $table_name is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
27
28
    /**
29
     * @var array
30
     */
31
    private static $db = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
Unused Code introduced by
The property $db is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
32
        'Processes' => 'Int',
33
        'Handler' => 'Varchar',
34
        'MinimumProcessorUsage' => 'Decimal',
35
        'MaximumProcessorUsage' => 'Decimal',
36
        'MinimumMemoryUsage' => 'Decimal',
37
        'MaximumMemoryUsage' => 'Decimal',
38
        'MinimumSiblingProcessorUsage' => 'Decimal',
39
        'MaximumSiblingProcessorUsage' => 'Decimal',
40
        'MinimumSiblingMemoryUsage' => 'Decimal',
41
        'MaximumSiblingMemoryUsage' => 'Decimal',
42
    );
43
44
    /**
45
     * @inheritdoc
46
     *
47
     * @return int
48
     */
49
    public function getProcesses()
50
    {
51
        if ($this->getField('Processes')) {
52
            return $this->getField('Processes');
53
        }
54
55
        return 1;
56
    }
57
58
    /**
59
     * @inheritdoc
60
     *
61
     * @return null|string
62
     */
63
    public function getHandler()
64
    {
65
        if ($this->getField('Handler')) {
66
            return $this->getField('Handler');
67
        }
68
69
        return null;
70
    }
71
72
    /**
73
     * @return null|float
74
     */
75
    public function getMinimumProcessorUsage()
76
    {
77
        if ($this->getField('MinimumProcessorUsage')) {
78
            return $this->getField('MinimumProcessorUsage');
79
        }
80
81
        return null;
82
    }
83
84
    /**
85
     * @inheritdoc
86
     *
87
     * @return null|float
88
     */
89
    public function getMaximumProcessorUsage()
90
    {
91
        if ($this->getField('MaximumProcessorUsage')) {
92
            return $this->getField('MaximumProcessorUsage');
93
        }
94
95
        return null;
96
    }
97
98
    /**
99
     * @inheritdoc
100
     *
101
     * @return null|float
102
     */
103
    public function getMinimumMemoryUsage()
104
    {
105
        if ($this->getField('MinimumMemoryUsage')) {
106
            return $this->getField('MinimumMemoryUsage');
107
        }
108
109
        return null;
110
    }
111
112
    /**
113
     * @return null|float
114
     */
115
    public function getMaximumMemoryUsage()
116
    {
117
        if ($this->getField('MaximumMemoryUsage')) {
118
            return $this->getField('MaximumMemoryUsage');
119
        }
120
121
        return null;
122
    }
123
124
    /**
125
     * @inheritdoc
126
     *
127
     * @return null|float
128
     */
129
    public function getMinimumSiblingProcessorUsage()
130
    {
131
        if ($this->getField('MinimumSiblingProcessorUsage')) {
132
            return $this->getField('MinimumSiblingProcessorUsage');
133
        }
134
135
        return null;
136
    }
137
138
    /**
139
     * @inheritdoc
140
     *
141
     * @return null|float
142
     */
143
    public function getMaximumSiblingProcessorUsage()
144
    {
145
        if ($this->getField('MaximumSiblingProcessorUsage')) {
146
            return $this->getField('MaximumSiblingProcessorUsage');
147
        }
148
149
        return null;
150
    }
151
152
    /**
153
     * @inheritdoc
154
     *
155
     * @return null|float
156
     */
157
    public function getMinimumSiblingMemoryUsage()
158
    {
159
        if ($this->getField('MinimumSiblingMemoryUsage')) {
160
            return $this->getField('MinimumSiblingMemoryUsage');
161
        }
162
163
        return null;
164
    }
165
166
    /**
167
     * @inheritdoc
168
     *
169
     * @return null|float
170
     */
171
    public function getMaximumSiblingMemoryUsage()
172
    {
173
        if ($this->getField('MaximumSiblingMemoryUsage')) {
174
            return $this->getField('MaximumSiblingMemoryUsage');
175
        }
176
177
        return null;
178
    }
179
}
180