@@ -9,8 +9,7 @@ |
||
9 | 9 | class C2CAOSVariables { |
10 | 10 | /// @brief Returns an array of tokens. |
11 | 11 | public static function GetTokens() { |
12 | - return array |
|
13 | - ( |
|
12 | + return array( |
|
14 | 13 | 'ownr', |
15 | 14 | 'from', |
16 | 15 | 'pntr', |
@@ -6,8 +6,7 @@ |
||
6 | 6 | class C2CAOSCommands { |
7 | 7 | /// @brief Returns an array of tokens. |
8 | 8 | public static function GetTokens() { |
9 | - return array |
|
10 | - ( |
|
9 | + return array( |
|
11 | 10 | //creation |
12 | 11 | 'new: scen', |
13 | 12 | 'new: simp', |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @param integer $start |
66 | 66 | */ |
67 | - public function GetSubString($start,$length = FALSE) { |
|
68 | - if($length == FALSE) { |
|
67 | + public function GetSubString($start, $length = FALSE) { |
|
68 | + if ($length == FALSE) { |
|
69 | 69 | $length = strlen($this->string)-$start; |
70 | 70 | } |
71 | - $str = substr($this->string,$start,$length); |
|
71 | + $str = substr($this->string, $start, $length); |
|
72 | 72 | return $str; |
73 | 73 | } |
74 | 74 | } |
@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | * @param false|string $string |
78 | 78 | */ |
79 | 79 | function BytesToIntLilEnd($string) { //little endian |
80 | - if($string == "") { |
|
80 | + if ($string == "") { |
|
81 | 81 | return false; |
82 | 82 | } |
83 | 83 | $length = strlen($string); |
84 | 84 | $int = 0; |
85 | - for($i=0;$i<$length;$i++) { |
|
86 | - $int += ord($string{$i})<<($i*8); |
|
85 | + for ($i = 0; $i < $length; $i++) { |
|
86 | + $int += ord($string{$i}) << ($i*8); |
|
87 | 87 | } |
88 | 88 | return $int; |
89 | 89 | } |
@@ -21,12 +21,15 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function FileReader($filename) |
23 | 23 | { |
24 | - if (!file_exists($filename)) |
|
25 | - throw new Exception("File does not exist: ".$filename); |
|
26 | - if (!is_file($filename)) |
|
27 | - throw new Exception("Target is not a file."); |
|
28 | - if (!is_readable($filename)) |
|
29 | - throw new Exception("File exists, but is not readable."); |
|
24 | + if (!file_exists($filename)) { |
|
25 | + throw new Exception("File does not exist: ".$filename); |
|
26 | + } |
|
27 | + if (!is_file($filename)) { |
|
28 | + throw new Exception("Target is not a file."); |
|
29 | + } |
|
30 | + if (!is_readable($filename)) { |
|
31 | + throw new Exception("File exists, but is not readable."); |
|
32 | + } |
|
30 | 33 | |
31 | 34 | $this->fp = fopen($filename, 'rb'); |
32 | 35 | } |
@@ -51,8 +54,9 @@ discard block |
||
51 | 54 | for ($x = 0; $x < $count; $x++) |
52 | 55 | { |
53 | 56 | $buffer = (ord(fgetc($this->fp)) << ($x*8)); |
54 | - if ($buffer === false) |
|
55 | - throw new Exception("Read failure"); |
|
57 | + if ($buffer === false) { |
|
58 | + throw new Exception("Read failure"); |
|
59 | + } |
|
56 | 60 | $int += $buffer; |
57 | 61 | } |
58 | 62 | return $int; |
@@ -54,7 +54,7 @@ |
||
54 | 54 | * @param $category One of the PRAY_DEPENDENCY_* constants |
55 | 55 | * @param $filename The name of the file this dependency relates to. |
56 | 56 | */ |
57 | - public function PrayDependency($category,$filename) { |
|
57 | + public function PrayDependency($category, $filename) { |
|
58 | 58 | $this->category = $category; |
59 | 59 | $this->filename = $filename; |
60 | 60 | } |
@@ -22,17 +22,17 @@ |
||
22 | 22 | * @param $name The block's name. |
23 | 23 | * @param $content The content of the block as a binary string. |
24 | 24 | */ |
25 | - public function BinaryBlock($type, $name, $content) { |
|
26 | - parent::PrayBlock(null, $name, '', 0, $type); |
|
27 | - $this->binarydata = $content; |
|
25 | + public function BinaryBlock($type, $name, $content) { |
|
26 | + parent::PrayBlock(null, $name, '', 0, $type); |
|
27 | + $this->binarydata = $content; |
|
28 | 28 | } |
29 | 29 | /// @brief Compile the BinaryBlock |
30 | 30 | /** |
31 | 31 | * @return string compiled BinaryBlock as a binary string. |
32 | 32 | */ |
33 | - public function Compile() { |
|
34 | - return $this->EncodeBlockHeader(strlen($this->binarydata)).$this->binarydata; |
|
35 | - } |
|
33 | + public function Compile() { |
|
34 | + return $this->EncodeBlockHeader(strlen($this->binarydata)).$this->binarydata; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | ?> |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * @param $type What type of COBBlock it is. Must be a 4-character string. |
24 | 24 | */ |
25 | 25 | public function COBBlock($type) { |
26 | - if(strlen($type) != 4) { |
|
26 | + if (strlen($type) != 4) { |
|
27 | 27 | throw new Exception('Invalid COB block type: '.$type); |
28 | 28 | } |
29 | 29 | $this->type = $type; |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @param $type The four-character type of the block |
16 | 16 | * @param $contents The contents of the block |
17 | 17 | */ |
18 | - public function COBUnknownBlock($type,$contents) { |
|
18 | + public function COBUnknownBlock($type, $contents) { |
|
19 | 19 | parent::COBBlock($type); |
20 | 20 | } |
21 | 21 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param $version The version number of this COB (integer) |
28 | 28 | * @param $revision the COB's revision number (integer) |
29 | 29 | */ |
30 | - public function COBAuthorBlock($authorName,$authorEmail,$authorURL,$authorComments,$creationTime,$version,$revision) { |
|
30 | + public function COBAuthorBlock($authorName, $authorEmail, $authorURL, $authorComments, $creationTime, $version, $revision) { |
|
31 | 31 | parent::COBBlock(COB_BLOCK_AUTHOR); |
32 | 32 | $this->authorName = $authorName; |
33 | 33 | $this->authorEmail = $authorEmail; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | $creationDay = $reader->ReadInt(1); |
109 | 109 | $creationMonth = $reader->ReadInt(1); |
110 | 110 | $creationYear = $reader->ReadInt(2); |
111 | - $timestamp = mktime(0,0,0,$creationMonth,$creationDay,$creationYear); |
|
111 | + $timestamp = mktime(0, 0, 0, $creationMonth, $creationDay, $creationYear); |
|
112 | 112 | $version = $reader->ReadInt(1); |
113 | 113 | $revision = $reader->ReadInt(1); |
114 | 114 | $authorName = $reader->ReadCString(); |