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.
Completed
Push — master ( 108f3b...905b81 )
by Telyn
01:45
created

COBAuthorBlock::Compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
require_once(dirname(__FILE__).'/COBBlock.php');
3
4
/// @brief Defines Author information about the COB
5
class COBAuthorBlock extends COBBlock {
6
7
    /// @cond INTERNAL_DOCS
8
    
9
    private $creationTime;
10
    private $version;
11
    private $revision;
12
    private $authorName;
13
    private $authorEmail;
14
    private $authorURL;
15
    private $authorComments;
16
17
    /// @endcond
18
19
    /// @brief Creates a new COBAuthorBlock
20
21
    /**
22
     * @param $authorName the name of the author of this COB
23
     * @param $authorEmail the author's email address
24
     * @param $authorURL The author's website address
25
     * @param $authorComments Any comments the author had about this COB
26
     * @param $creationTime the time this COB was compiled as a UNIX timestamp
27
     * @param $version The version number of this COB (integer)
28
     * @param $revision the COB's revision number (integer)
29
     */
30
    public function COBAuthorBlock($authorName, $authorEmail, $authorURL, $authorComments, $creationTime, $version, $revision) {
31
        parent::COBBlock(COB_BLOCK_AUTHOR);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (COBBlock() instead of COBAuthorBlock()). Are you sure this is correct? If so, you might want to change this to $this->COBBlock().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
32
        $this->authorName = $authorName;
33
        $this->authorEmail = $authorEmail;
34
        $this->authorURL = $authorURL;
35
        $this->authorComments = $authorComments;
36
        $this->creationTime = $creationTime;
37
        $this->version = $version;
38
        $this->revision = $revision;
39
    }
40
41
    /// @brief Supposedly compiles the block into binary. Throws an error to say it's not implemented.
42
    /** @return string
43
     */
44
    public function Compile() {
45
        // TODO: implement
46
        throw new Exception("COBAgentBlock::Compile not implemented");
47
    }
48
49
    /// @brief Gets the name of the author
50
    /**
51
     *  @return Author's name
0 ignored issues
show
Documentation introduced by
The doc-type Author's could not be parsed: Unknown type name "Author's" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
52
     */
53
    public function GetAuthorName() {
54
        return $this->authorName;
55
    }
56
57
    /// @brief Gets the author's email address
58
    /**
59
     *  @return string
60
     */
61
    public function GetAuthorEmail() {
62
        return $this->authorEmail;
63
    }
64
65
    /// @brief Gets the author's web address
66
    /**
67
     * @return string
68
     */
69
    public function GetAuthorURL() {
70
        return $this->authorURL;
71
    }
72
73
    /// @brief Gets comments from the author
74
    /**
75
     * @return string
76
     */
77
    public function GetAuthorComments() {
78
        return $this->authorComments;
79
    }
80
81
    /// @brief Gets the time this COB was created
82
    /**
83
     *  @return A UNIX timestamp representing the time this COB was created.
84
     */
85
    public function GetCreationTime() {
86
        return $this->creationTime;
87
    }
88
89
    /// @brief Gets the COB's version number
90
    /**
91
     * @see GetRevision()
92
     * @return An integer
93
     */
94
    public function GetVersion() {
95
        return $this->version;
96
    }
97
98
    /// @brief Gets the COB's revision number
99
    /**
100
     * The revision number is less significant than the version 
101
     * number.
102
     * @return An integer
103
     */
104
    public function GetRevision() {
105
        return $this->revision;
106
    }
107
108
    /// @cond INTERNAL_DOCS
109
110
    /// @brief Creates the COBAuthorBlock from an IReader.
111
    /**
112
     * @param $reader The IReader, currently at the position of the author block  
113
     * @return COBAuthorBlock
114
     */
115
    public static function CreateFromReader(IReader $reader) {
116
        $creationDay = $reader->ReadInt(1);
117
        $creationMonth = $reader->ReadInt(1);
118
        $creationYear = $reader->ReadInt(2);
119
        $timestamp = mktime(0, 0, 0, $creationMonth, $creationDay, $creationYear);
0 ignored issues
show
Unused Code introduced by
$timestamp is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
120
        $version = $reader->ReadInt(1);
0 ignored issues
show
Unused Code introduced by
$version is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
121
        $revision = $reader->ReadInt(1);
0 ignored issues
show
Unused Code introduced by
$revision is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
122
        $authorName = $reader->ReadCString();
0 ignored issues
show
Unused Code introduced by
$authorName is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
123
        $authorEmail = $reader->ReadCString();
0 ignored issues
show
Unused Code introduced by
$authorEmail is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
124
        $authorURL = $reader->ReadCString();
0 ignored issues
show
Unused Code introduced by
$authorURL is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
125
        $authorComments = $reader->ReadCString();
0 ignored issues
show
Unused Code introduced by
$authorComments is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
126
		
127
        return $readerData;
0 ignored issues
show
Bug introduced by
The variable $readerData does not exist. Did you mean $reader?

This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name.

The variable may have been renamed without also renaming all references.

Loading history...
128
    }
129
    /// @endcond
130
}
131
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
132