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

COBFileBlock::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 the bock to represent a file block in a COB file.
5
class COBFileBlock extends COBBlock {
6
7
    /// @cond INTERNAL_DOCS
8
    //
9
    private $fileType;
10
    private $fileName;
11
	
12
    private $reserved;
13
    private $contents;
14
15
    /// @endcond
16
17
    /// @brief Constructs a new COBFileBlock
18
    /**
19
     * @param string $type The file type
20
     * @param $name The file name (including extension)
21
     * @param $contents The contents of the file
22
     */
23
    public function COBFileBlock($type, $name, $contents) {
24
        parent::COBBlock(COB_BLOCK_FILE);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (COBBlock() instead of COBFileBlock()). 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...
25
        $this->fileType = $type;
26
        $this->fileName = $name;
27
        $this->contents = $contents;
28
    }
29
30
    /// @brief Add the reserved data associated with this file block
31
    /**
32
     * @param $reserved The reserved data
33
     */
34
    public function AddReserved($reserved) {
35
        $this->reserved = $reserved;
36
    }
37
    
38
    /// @brief Supposedly compiles the block into binary. Throws an error to say it's not implemented.
39
    /** @return string
40
     */
41
    public function Compile() {
42
        // TODO: implement
43
        throw new Exception("COBAgentBlock::Compile not implemented");
44
    }
45
46
    /// @brief Get the name of the file
47
    public function GetName() {
48
        return $this->fileName;
49
    }
50
51
    /// @brief Get the file's type
52
    /**
53
     * @return 'sprite' or 'sound' - i.e. one of the
0 ignored issues
show
Documentation introduced by
The doc-type 'sprite' could not be parsed: Unknown type name "'sprite'" 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...
54
     * COB_DEPENDENCY_* constants in COBAgentBlock
55
     */
56
    public function GetFileType() {
57
        return $this->fileType;
58
    }
59
60
    /// @brief Get the contents of the file.
61
    public function GetContents() {
62
        return $this->contents;
63
    }
64
65
    /// @brief Get the reserved data
66
    /**
67
     * Reserved data was never officially used.
68
     * @return A 4-byte integer.
69
     */
70
    public function GetReserved() {
71
        return $this->reserved;
72
    }
73
74
    /// @cond INTERNAL_DOCS
75
76
    /// @brief Creates a new COBFileBlock from an IReader
77
    /**
78
     * @param $reader The reader the data's coming from
79
     */
80
    public static function CreateFromReader(IReader $reader) {
81
        $type = ($reader->ReadInt(2) == 0) ? 'sprite' : 'sound';
82
        $reserved = $reader->ReadInt(4);
83
        $size = $reader->ReadInt(4);
84
        $fileName = $reader->ReadCString();
85
        $contents = $reader->Read($size);
86
        $block = new COBFileBlock($type, $fileName, $contents);
87
        $block->AddReserved($reserved);
88
        return $block;
89
    }
90
    /// @endcond
91
}
92
?>
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...
93