Completed
Push — master ( bc825a...1aba9a )
by William
06:03
created

SyncGithubIssueStatesShell   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 81.82%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 27
dl 0
loc 43
ccs 18
cts 22
cp 0.8182
rs 10
c 2
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A main() 0 36 2
A initialize() 0 3 1
1
<?php
2
/* vim: set expandtab sw=4 ts=4 sts=4: */
3
4
/**
5
 * Sync Github issue states Shell.
6
 *
7
 * phpMyAdmin Error reporting server
8
 * Copyright (c) phpMyAdmin project (https://www.phpmyadmin.net/)
9
 *
10
 * Licensed under The MIT License
11
 * For full copyright and license information, please see the LICENSE.txt
12
 * Redistributions of files must retain the above copyright notice.
13
 *
14
 * @copyright Copyright (c) phpMyAdmin project (https://www.phpmyadmin.net/)
15
 * @license   https://opensource.org/licenses/mit-license.php MIT License
16
 *
17
 * @see      https://www.phpmyadmin.net/
18
 */
19
20
namespace App\Shell;
21
22
use Cake\Console\Shell;
23
use Cake\Core\Configure;
24
use Cake\Log\Log;
25
use Cake\Http\ServerRequest;
26
use Cake\Http\Response;
27
use Cake\Routing\DispatcherFactory;
28
use Cake\Routing\Router;
29
30
/**
31
 * Sync Github issue states Shell.
32
 */
33
class SyncGithubIssueStatesShell extends Shell
34
{
35
    public function initialize()
36
    {
37
        parent::initialize();
38
    }
39
40 1
    public function main()
41
    {
42 1
        Log::debug(
43
            'STARTED: Job "'
44
                . 'github/sync_issue_status'
45
                . '" at '
46 1
                . date('d-m-Y G:i:s (e)'),
47 1
            ['scope' => 'cron_jobs']
48
        );
49
50
51 1
        Configure::write('CronDispatcher', true);
52 1
        if (PHP_SAPI === 'cli') {
53 1
            $dispatcher = DispatcherFactory::create();
54
55 1
            $request = new ServerRequest('github/sync_issue_status');
56 1
            $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

56
            $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...
57 1
                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

57
                /** @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...
58 1
                    $request->getPath(),
59 1
                    ''
60
                )
61
            );
62 1
            $dispatcher->dispatch(
63 1
                $request,
64 1
                new Response()
65
            );
66
        } else {
67
            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...
68
        }
69
70 1
        Log::debug(
71
            'FINISHED: Job "'
72
                . 'github/sync_issue_status'
73
                . '" at '
74 1
                . date('d-m-Y G:i:s (e)'),
75 1
            ['scope' => 'cron_jobs']
76
        );
77 1
    }
78
}
79