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); |
|
|
|
|
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 |
|
|
|
|
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); |
|
|
|
|
120
|
|
|
$version = $reader->ReadInt(1); |
|
|
|
|
121
|
|
|
$revision = $reader->ReadInt(1); |
|
|
|
|
122
|
|
|
$authorName = $reader->ReadCString(); |
|
|
|
|
123
|
|
|
$authorEmail = $reader->ReadCString(); |
|
|
|
|
124
|
|
|
$authorURL = $reader->ReadCString(); |
|
|
|
|
125
|
|
|
$authorComments = $reader->ReadCString(); |
|
|
|
|
126
|
|
|
|
127
|
|
|
return $readerData; |
|
|
|
|
128
|
|
|
} |
129
|
|
|
/// @endcond |
130
|
|
|
} |
131
|
|
|
?> |
|
|
|
|
132
|
|
|
|
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:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.