Completed
Push — master ( 056908...e3bd71 )
by Michal
02:52
created

SyncGithubIssueStatesShell::main()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 42
Code Lines 27

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 19
CRAP Score 3.0077

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 42
ccs 19
cts 21
cp 0.9048
rs 8.8571
cc 3
eloc 27
nc 4
nop 0
crap 3.0077
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
        if (!defined('CRON_DISPATCHER')) {
51
            define('CRON_DISPATCHER', true);
52
        }
53 1
        if (PHP_SAPI === 'cli') {
54 1
            $dispatcher = DispatcherFactory::create();
55
56 1
            $request = new Request('github/sync_issue_status');
57 1
            $request = $request->addParams(
58 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...
59 1
                    $request->url,
60 1
                    ''
61
                )
62
            );
63 1
            $dispatcher->dispatch(
64 1
                $request,
65 1
                new Response()
66
            );
67
        }
68
        else {
69
            exit;
70
        }
71
72 1
        Log::debug(
73
            'FINISHED: Job "'
74
                . 'github/sync_issue_status'
75
                . '" at '
76 1
                . date('d-m-Y G:i:s (e)'),
77 1
            ['scope' => 'cron_jobs']
78
        );
79
80 1
    }
81
}
82