Conditions | 2 |
Paths | 2 |
Total Lines | 35 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 2.0005 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 4 | public function main(): void |
|
37 | { |
||
38 | 4 | Log::debug( |
|
39 | 'STARTED: Job "' |
||
40 | . 'github/sync_issue_status' |
||
41 | . '" at ' |
||
42 | 4 | . date('d-m-Y G:i:s (e)'), |
|
43 | 4 | ['scope' => 'cron_jobs'] |
|
44 | ); |
||
45 | |||
46 | 4 | Configure::write('CronDispatcher', true); |
|
47 | 4 | if (PHP_SAPI !== 'cli') { |
|
48 | exit; |
||
|
|||
49 | } |
||
50 | |||
51 | 4 | $dispatcher = DispatcherFactory::create(); |
|
52 | |||
53 | 4 | $request = new ServerRequest('github/sync_issue_status'); |
|
54 | 4 | $request = $request->addParams( |
|
55 | 4 | Router::parse( |
|
56 | 4 | $request->getPath(), |
|
57 | 4 | '' |
|
58 | ) |
||
59 | ); |
||
60 | 4 | $dispatcher->dispatch( |
|
61 | 4 | $request, |
|
62 | 4 | new Response() |
|
63 | ); |
||
64 | |||
65 | 4 | Log::debug( |
|
66 | 'FINISHED: Job "' |
||
67 | . 'github/sync_issue_status' |
||
68 | . '" at ' |
||
69 | 4 | . date('d-m-Y G:i:s (e)'), |
|
70 | 4 | ['scope' => 'cron_jobs'] |
|
71 | ); |
||
74 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.