1 | <?php namespace Comodojo\Extender\Utils; |
||
23 | class Validator { |
||
24 | |||
25 | /** |
||
26 | * Validate a cron expression and, if valid, return next run timestamp plus |
||
27 | * an array of expression parts |
||
28 | * |
||
29 | * @param string $expression |
||
30 | * |
||
31 | * @return array Next run timestamp at first position, expression parts at second |
||
32 | * @throws \Exception |
||
33 | */ |
||
34 | public static function cronExpression($expression) { |
||
62 | |||
63 | public static function laggerTimeout($timeout) { |
||
64 | |||
65 | return DataFilter::filterInteger( |
||
66 | $timeout, |
||
67 | 0, |
||
68 | PHP_INT_MAX, |
||
69 | 5 |
||
70 | ); |
||
71 | |||
72 | } |
||
73 | |||
74 | 6 | public static function maxChildRuntime($runtime) { |
|
75 | |||
76 | 6 | return DataFilter::filterInteger( |
|
77 | 6 | $runtime, |
|
78 | 6 | 1, |
|
79 | 6 | PHP_INT_MAX, |
|
80 | 6 | 600 |
|
81 | ); |
||
82 | |||
83 | } |
||
84 | |||
85 | public static function forkLimit($limit) { |
||
86 | |||
87 | return DataFilter::filterInteger( |
||
88 | $limit, |
||
89 | 0, |
||
90 | PHP_INT_MAX, |
||
91 | 5 |
||
92 | ); |
||
93 | |||
94 | } |
||
95 | |||
96 | 6 | public static function niceness($niceness) { |
|
97 | |||
98 | 6 | return DataFilter::filterInteger( |
|
99 | 6 | $niceness, |
|
100 | 6 | -20, |
|
101 | 6 | 20, |
|
102 | 0 |
||
103 | ); |
||
104 | |||
105 | } |
||
106 | |||
107 | public static function multithread($multithread) { |
||
112 | |||
113 | } |
||
114 |