1 | <?php |
||
9 | class Worker extends AbstractWorker |
||
10 | { |
||
11 | |||
12 | //region Config *********************************************************** |
||
13 | |||
14 | protected static $config |
||
15 | = [ |
||
16 | AbstractWorker::CONFIG_P_MANAGERS_LIMIT => 3, |
||
17 | AbstractWorker::CONFIG_P_MANAGER_POOL_SIZE => 5, |
||
18 | AbstractWorker::CONFIG_P_MANAGER_IDLE_DIE_DELAY => 5, |
||
19 | self::GATEWAY_CLASS_SET => [ |
||
20 | '\Messenger\Sms\Alpha\Worker' => [ |
||
21 | self::GATEWAY_CLASS_P_REGEX_RECIPIENT => '/^(38)/' |
||
22 | ], |
||
23 | '\Messenger\Sms\Test\Worker' => [ |
||
24 | self::GATEWAY_CLASS_P_REGEX_RECIPIENT => '/^(38)/' |
||
25 | ], |
||
26 | ], |
||
27 | ]; |
||
28 | |||
29 | //endregion **************************************************************** |
||
30 | |||
31 | //region GATEWAY *********************************************************** |
||
32 | |||
33 | const GATEWAY_DISPATCH_CLASS = 'gatewayDispatchClass'; |
||
34 | const GATEWAY_CLASS_SET = 'gatewayClassSet'; |
||
35 | const GATEWAY_CLASS_P_REGEX_RECIPIENT = 'regexRecipient'; |
||
36 | |||
37 | /** |
||
38 | * @param Job $job |
||
39 | * |
||
40 | * @return array |
||
41 | * @throws WorkerException |
||
42 | */ |
||
43 | 3 | protected function analiseGateway(Job $job) |
|
71 | |||
72 | //endregion *************************************************************** |
||
73 | |||
74 | // region Default Result Data************************************************************** |
||
75 | |||
76 | const P_RESULT_DATA_VENDOR_NAME = 'vendor'; |
||
77 | const P_RESULT_DATA_VENDOR_ID = 'vendor_id'; |
||
78 | const P_RESULT_DATA_SUCCESS = 'success'; |
||
79 | const P_RESULT_DATA_ERRORS = 'errors'; |
||
80 | |||
81 | /** |
||
82 | * @param null $vendor_name |
||
83 | * @param null $vendor_id |
||
84 | * @param null $success |
||
85 | * @param null $errors |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | 5 | public static function buildResultDataDefault( |
|
102 | |||
103 | //endregion *************************************************************** |
||
104 | |||
105 | /** |
||
106 | * if job is sync then we get worker and try execute job |
||
107 | * else if job is Async then redirect to other queue |
||
108 | * |
||
109 | * REMEMBER: Queue name is equal to Worker class name (through all "Cronario") |
||
110 | * |
||
111 | * @param AbstractJob|Job $job |
||
112 | * |
||
113 | * @throws ResultException |
||
114 | * @throws WorkerException |
||
115 | */ |
||
116 | 3 | protected function doJob(AbstractJob $job) |
|
136 | } |
This check looks for the bodies of
if
statements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
if
bodies can be removed. If you have an empty if but statements in theelse
branch, consider inverting the condition.could be turned into
This is much more concise to read.