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.

GitHub::init()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 4
nc 3
nop 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 13 and the first side effect is on line 11.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * Created by PhpStorm.
4
 * User: pedro
5
 * Date: 28/11/16
6
 * Time: 11:39
7
 */
8
9
namespace Classes\Update\Content;
10
11
require_once 'AbstractContent.php';
12
13
class GitHub extends AbstractContent
14
{
15
    private static $tagsGithub  = "https://api.github.com/repos/pedro151/orm-generator/tags";
16
    private static $listVersion = array ();
17
    private        $phar        = "https://raw.githubusercontent.com/pedro151/orm-generator/%s/bin/orm-generator.phar";
18
    //private        $phar        = "https://github.com/pedro151/orm-generator/blob/%s/bin/orm-generator.phar?raw=true";
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
19
20
    /**
21
     * @return mixed
22
     */
23
    public function getInfo ()
24
    {
25
        return json_decode ( $this->getContent ( self::$tagsGithub ) );
26
    }
27
28
    /**
29
     *
30
     */
31
    protected function init ()
32
    {
33
        if ( is_array ( $this->getInfo () ) )
34
        {
35
            foreach ( $this->getInfo () as $index => $objTag )
36
            {
37
                self::$listVersion[ preg_replace ( "/[^0-9.]/" , "" , $objTag->name ) ] = sprintf ( $this->phar , $objTag->name );
38
            }
39
        }
40
    }
41
42
    /**
43
     * @return mixed
44
     */
45
    public function getLastVersion ()
46
    {
47
        return current ( array_keys ( self::$listVersion ) );
48
    }
49
50
    /**
51
     * @return mixed
52
     */
53
    public function getLastPhar ()
54
    {
55
        reset ( self::$listVersion );
56
57
        return current ( self::$listVersion );
58
    }
59
60
    /**
61
     * @param $version
62
     *
63
     * @return mixed
64
     */
65
    public function getPharByVersion ( $version )
66
    {
67
        return self::$listVersion[ $version ];
68
    }
69
70
    public function hasPharByVersion ( $version )
71
    {
72
        return isset( self::$listVersion[ $version ] );
73
    }
74
75
}