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.
Test Failed
Push — master ( 4180f9...c1073f )
by Rob
03:47
created

Shodan::getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 2
rs 10
cc 1
nc 1
nop 0
1
<?php
0 ignored issues
show
Coding Style introduced by
Class found in ".php" file; use ".inc" extension instead
Loading history...
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "Shodan.php" doesn't match the expected filename "shodan.php"
Loading history...
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace RattfieldNz\Shodan;
4
5
use ErrorException;
6
use RattfieldNz\Shodan\Libraries\Curl\Curl;
7
use RattfieldNz\Shodan\Libraries\Data\Data;
8
9
/**
10
 * Class Shodan.
11
 *
12
 * @category PHP
0 ignored issues
show
Coding Style Documentation introduced by
@category tag is not allowed in class comment
Loading history...
13
 *
14
 * @author  Rob Attfield <[email protected]>
0 ignored issues
show
Coding Style Documentation introduced by
@author tag is not allowed in class comment
Loading history...
15
 * @license https://github.com/rattfieldnz/shodan/blob/master/LICENSE MIT
0 ignored issues
show
Coding Style Documentation introduced by
@license tag is not allowed in class comment
Loading history...
16
 */
0 ignored issues
show
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
17
class Shodan
18
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class Shodan
Loading history...
19
    private $_url;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
20
21
    private $_results;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
22
23
    private $_data;
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
24
25
    public function __construct()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
Coding Style introduced by
Missing doc comment for function __construct()
Loading history...
26
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
27
        $this->_results = null;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of null please use NULL.
Loading history...
28
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end __construct()
Loading history...
29
30
    /**
31
     * Add URL to be checked with Shodan API.
32
     *
33
     * @param string $url The URL to be checked.
34
     *
35
     * @return Shodan.
0 ignored issues
show
Documentation Bug introduced by
The doc comment Shodan. at position 0 could not be parsed: Unknown type name 'Shodan.' at position 0 in Shodan..
Loading history...
36
     */
37
    public function setUrl(string $url)
38
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
39
        $this->_url = $url;
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 2 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
40
        $this->_data = new Data($this->_url);
41
        return $this;
42
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end setUrl()
Loading history...
43
44
    /**
45
     * Checks a given URL with Shodan API.
46
     *
47
     * @return Shodan
48
     *
49
     * @throws ErrorException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
50
     */
51
    public function check()
52
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
53
        $error = [
0 ignored issues
show
Coding Style introduced by
Short array syntax is not allowed
Loading history...
54
            'status' => 500,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 18 spaces, but found 12.
Loading history...
Coding Style introduced by
Array double arrow not aligned correctly; expected 3 space(s) but found 1
Loading history...
55
            'response' => 'URL cannot be null.'
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 18 spaces, but found 12.
Loading history...
Coding Style introduced by
Each line in an array declaration must end in a comma
Loading history...
56
        ];
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 17 space(s), but found 8.
Loading history...
57
58
        $this->_results = empty($this->getUrl()) || empty($this->_data) ?
0 ignored issues
show
Coding Style introduced by
The value of a boolean operation must not be assigned to a variable
Loading history...
Coding Style introduced by
Boolean operators are not allowed outside of control structure conditions
Loading history...
Coding Style introduced by
Expected 1 space after "?"; newline found
Loading history...
Coding Style introduced by
Inline IF statements are not allowed
Loading history...
Coding Style introduced by
Inline shorthand IF statement must be declared on a single line
Loading history...
59
            $error : (new Curl($this->_data))->getData();
60
61
        return $this;
62
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end check()
Loading history...
63
64
    /**
65
     * Get current URL.
66
     *
67
     * @return string|null
68
     */
69
    public function getUrl(){
0 ignored issues
show
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
70
        return $this->_url;
71
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getUrl()
Loading history...
72
73
    /**
74
     * Get results of Shodan API call.
75
     *
76
     * @param bool $jsonEncode Encode results as JSON, or
0 ignored issues
show
Coding Style introduced by
Expected "boolean" but found "bool" for parameter type
Loading history...
Coding Style introduced by
Tag value for @param tag indented incorrectly; expected 2 spaces but found 1
Loading history...
77
     *             return as associative arrag.
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 25 spaces but found 13
Loading history...
78
     * @return mixed|null
0 ignored issues
show
Coding Style introduced by
Tag @return cannot be grouped with parameter tags in a doc comment
Loading history...
79
     */
80
    public function getResults(bool $jsonEncode = false){
0 ignored issues
show
Coding Style introduced by
Incorrect spacing between argument "$jsonEncode" and equals sign; expected 0 but found 1
Loading history...
Coding Style introduced by
Incorrect spacing between default value and equals sign for argument "$jsonEncode"; expected 0 but found 1
Loading history...
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of false please use FALSE.
Loading history...
Coding Style introduced by
Expected 1 space before opening brace; found 0
Loading history...
81
        if(empty($this->_results)){
0 ignored issues
show
Coding Style introduced by
Expected 1 space(s) after IF keyword; 0 found
Loading history...
Coding Style introduced by
Expected "if (...) {\n"; found "if(...){\n"
Loading history...
Coding Style introduced by
There must be a single space between the closing parenthesis and the opening brace of a multi-line IF statement; found 0 spaces
Loading history...
82
            return null;
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of null please use NULL.
Loading history...
83
        }
0 ignored issues
show
Coding Style introduced by
No blank line found after control structure
Loading history...
84
        return $jsonEncode === false ?
0 ignored issues
show
Coding Style introduced by
TRUE, FALSE and NULL should be uppercase as per the configured coding-style; instead of false please use FALSE.
Loading history...
Coding Style introduced by
Expected 1 space after "?"; newline found
Loading history...
Coding Style introduced by
Inline IF statements are not allowed
Loading history...
Coding Style introduced by
Inline shorthand IF statement must be declared on a single line
Loading history...
85
            $this->_results : json_encode($this->_results);
86
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end getResults()
Loading history...
87
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
88