Completed
Push — master ( 9ded53...cc9938 )
by Deven
02:34
created

SyncGithubIssueStatesShell   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 82.61%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 5
dl 0
loc 48
ccs 19
cts 23
cp 0.8261
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B main() 0 40 2
A initialize() 0 4 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\Log\Log;
24
use Cake\Network\Request;
25
use Cake\Network\Response;
26
use Cake\Routing\DispatcherFactory;
27
use Cake\Routing\Router;
28
29
/**
30
 * Sync Github issue states Shell.
31
 */
32
class SyncGithubIssueStatesShell extends Shell
33
{
34
    public function initialize()
35
    {
36
        parent::initialize();
37
    }
38
39 1
    public function main()
40
    {
41 1
        Log::debug(
42
            'STARTED: Job "'
43
                . 'github/sync_issue_status'
44
                . '" at '
45 1
                . date('d-m-Y G:i:s (e)'),
46 1
            ['scope' => 'cron_jobs']
47
        );
48
49
50 1
        define('CRON_DISPATCHER', true);
51 1
        if (PHP_SAPI === 'cli') {
52 1
            $dispatcher = DispatcherFactory::create();
53
54 1
            $request = new Request('github/sync_issue_status');
55 1
            $request = $request->addParams(
56 1
                Router::parse(
0 ignored issues
show
Deprecated Code introduced by
The method Cake\Routing\Router::parse() has been deprecated with message: 3.4.0 Use Router::parseRequest() instead.

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

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

Loading history...
57 1
                    $request->url,
58 1
                    ''
59
                )
60
            );
61 1
            $dispatcher->dispatch(
62 1
                $request,
63 1
                new Response()
64
            );
65
        }
66
        else {
67
            exit;
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
78 1
    }
79
}
80