GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — dev-master ( 69d5d6...22ebbe )
by Vijay
35:42
created

Index::running()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 22
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
cc 2
eloc 13
c 2
b 0
f 1
nc 2
nop 2
dl 0
loc 22
rs 9.2
1
<?php
2
3
namespace App\CLI;
4
5
/**
6
 * Index CLI Class.
7
 *
8
 * @author Vijay Mahrra <[email protected]>
9
 * @copyright (c) Copyright 2015 Vijay Mahrra
10
 * @license GPLv3 (http://www.gnu.org/licenses/gpl-3.0.html)
11
 */
12
class Index extends Base
13
{
14
    /**
15
     * @param \Base $f3
16
     * @param array $params
17
     * @return void
18
     */
19
    public function index(\Base $f3, array $params = [])
3 ignored issues
show
Unused Code introduced by
The parameter $f3 is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $f3. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
20
    {
21
        $cli = $this->cli;
22
        $cli->shoutBold(__METHOD__);
23
        $cli->shout('Hello World!');
24
    }
25
26
    /**
27
     * example to test if already running
28
     * run cli.php '/index/running' in two different terminals
29
     * @param \Base $f3
30
     * @param array $params
31
     * @return void
32
     */
33
    public function running(\Base $f3, array $params = [])
3 ignored issues
show
Unused Code introduced by
The parameter $f3 is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $params is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $f3. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
34
    {
35
        $cli = $this->cli;
36
        $cli->shoutBold(__METHOD__);
37
38
        // use process id for log notifications
39
        $mypid = getmypid();
40
        $pid   = $mypid['PID'];
41
        $msg   = $pid . ': Starting...';
42
        $cli->shout($msg);
43
44
        // check if already running, quit if so
45
        exec('ps auxww | grep -i index/running | grep -v grep', $ps);
0 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $ps. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
46
47
        if (1 < count($ps)) {
48
            $msg = $pid . ': Already running! Quitting.';
49
            $cli->shout($msg);
50
            return false;
51
        }
52
53
        sleep(10);
54
    }
55
}
56