Completed
Push — master ( 07e3a8...9561cd )
by William
16:58 queued 14:23
created

SyncGithubIssueStatesShell   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 94.74%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 24
dl 0
loc 37
ccs 18
cts 19
cp 0.9474
rs 10
c 2
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A main() 0 35 2
1
<?php
2
3
/**
4
 * Sync Github issue states Shell.
5
 *
6
 * phpMyAdmin Error reporting server
7
 * Copyright (c) phpMyAdmin project (https://www.phpmyadmin.net/)
8
 *
9
 * Licensed under The MIT License
10
 * For full copyright and license information, please see the LICENSE.txt
11
 * Redistributions of files must retain the above copyright notice.
12
 *
13
 * @copyright Copyright (c) phpMyAdmin project (https://www.phpmyadmin.net/)
14
 * @license   https://opensource.org/licenses/mit-license.php MIT License
15
 *
16
 * @see      https://www.phpmyadmin.net/
17
 */
18
19
namespace App\Shell;
20
21
use Cake\Console\Shell;
22
use Cake\Core\Configure;
23
use Cake\Http\Response;
24
use Cake\Http\ServerRequest;
25
use Cake\Log\Log;
26
use Cake\Routing\DispatcherFactory;
27
use Cake\Routing\Router;
28
use const PHP_SAPI;
29
use function date;
30
31
/**
32
 * Sync Github issue states Shell.
33
 */
34
class SyncGithubIssueStatesShell extends Shell
35
{
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;
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
49
        }
50
51 4
        $dispatcher = DispatcherFactory::create();
52
53 4
        $request = new ServerRequest('github/sync_issue_status');
54 4
        $request = $request->addParams(
0 ignored issues
show
Deprecated Code introduced by
The function Cake\Http\ServerRequest::addParams() has been deprecated: 3.6.0 ServerRequest::addParams() is deprecated. Use `withParam()` or `withAttribute('params')` instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

54
        $request = /** @scrutinizer ignore-deprecated */ $request->addParams(

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
55 4
            Router::parse(
0 ignored issues
show
Deprecated Code introduced by
The function Cake\Routing\Router::parse() has been deprecated: 3.4.0 Use Router::parseRequest() instead. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

55
            /** @scrutinizer ignore-deprecated */ Router::parse(

This function has been deprecated. The supplier of the function has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.

Loading history...
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
        );
72 4
    }
73
}
74