Passed
Push — master ( 931c46...651cd8 )
by smiley
01:22
created
src/WSDBException.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,4 +12,4 @@
 block discarded – undo
12 12
 
13 13
 namespace codemasher\WildstarDB;
14 14
 
15
-class WSDBException extends \Exception{}
15
+class WSDBException extends \Exception {}
Please login to merge, or discard this patch.
src/ReaderInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 
15 15
 use chillerlan\Database\Database;
16 16
 
17
-interface ReaderInterface{
17
+interface ReaderInterface {
18 18
 
19 19
 	/**
20 20
 	 * @param string $name
Please login to merge, or discard this patch.
src/includes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,6 @@
 block discarded – undo
9 9
 
10 10
 namespace codemasher\WildstarDB;
11 11
 
12
-if(!defined('WSDB_FUNCTIONS')){
12
+if (!defined('WSDB_FUNCTIONS')) {
13 13
 	require_once __DIR__.'/functions.php';
14 14
 }
Please login to merge, or discard this patch.
src/functions.php 2 patches
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -17,11 +17,9 @@  discard block
 block discarded – undo
17 17
 
18 18
 	if($endianness === true){ // big-endian
19 19
 		$f = 'N';
20
-	}
21
-	elseif($endianness === false){ // little-endian
20
+	} elseif($endianness === false){ // little-endian
22 21
 		$f = 'V';
23
-	}
24
-	else{ // machine byte order
22
+	} else{ // machine byte order
25 23
 		$f = 'L';
26 24
 	}
27 25
 
@@ -34,11 +32,9 @@  discard block
 block discarded – undo
34 32
 
35 33
 	if($endianness === true){ // big-endian
36 34
 		$f = 'J';
37
-	}
38
-	elseif($endianness === false){ // little-endian
35
+	} elseif($endianness === false){ // little-endian
39 36
 		$f = 'P';
40
-	}
41
-	else{ // machine byte order
37
+	} else{ // machine byte order
42 38
 		$f = 'Q';
43 39
 	}
44 40
 
@@ -51,11 +47,9 @@  discard block
 block discarded – undo
51 47
 
52 48
 	if($endianness === true){ // big-endian
53 49
 		$f = 'G';
54
-	}
55
-	elseif($endianness === false){ // little-endian
50
+	} elseif($endianness === false){ // little-endian
56 51
 		$f = 'g';
57
-	}
58
-	else{ // machine byte order
52
+	} else{ // machine byte order
59 53
 		$f = 'f';
60 54
 	}
61 55
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @return array|string|false
21 21
  */
22
-function uint32($i, bool $endianness = null){
22
+function uint32($i, bool $endianness = null) {
23 23
 
24
-	if($endianness === true){ // big-endian
24
+	if ($endianness === true) { // big-endian
25 25
 		$f = 'N';
26 26
 	}
27
-	elseif($endianness === false){ // little-endian
27
+	elseif ($endianness === false) { // little-endian
28 28
 		$f = 'V';
29 29
 	}
30
-	else{ // machine byte order
30
+	else { // machine byte order
31 31
 		$f = 'L';
32 32
 	}
33 33
 
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
  *
43 43
  * @return array|string|false
44 44
  */
45
-function uint64($i, bool $endianness = null){
45
+function uint64($i, bool $endianness = null) {
46 46
 
47
-	if($endianness === true){ // big-endian
47
+	if ($endianness === true) { // big-endian
48 48
 		$f = 'J';
49 49
 	}
50
-	elseif($endianness === false){ // little-endian
50
+	elseif ($endianness === false) { // little-endian
51 51
 		$f = 'P';
52 52
 	}
53
-	else{ // machine byte order
53
+	else { // machine byte order
54 54
 		$f = 'Q';
55 55
 	}
56 56
 
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
  *
66 66
  * @return array|string|false
67 67
  */
68
-function float($i, bool $endianness = null){
68
+function float($i, bool $endianness = null) {
69 69
 
70
-	if($endianness === true){ // big-endian
70
+	if ($endianness === true) { // big-endian
71 71
 		$f = 'G';
72 72
 	}
73
-	elseif($endianness === false){ // little-endian
73
+	elseif ($endianness === false) { // little-endian
74 74
 		$f = 'g';
75 75
 	}
76
-	else{ // machine byte order
76
+	else { // machine byte order
77 77
 		$f = 'f';
78 78
 	}
79 79
 
Please login to merge, or discard this patch.
src/AIDXReader.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * @property array $dirs
19 19
  */
20
-class AIDXReader extends PACKReaderAbstract{
20
+class AIDXReader extends PACKReaderAbstract {
21 21
 
22 22
 	/** @var array */
23 23
 	protected $dirs;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 			\fread($this->fh, $this->blocktable[$this->header['RootInfoIndex']]['Size'])
34 34
 		);
35 35
 
36
-		if($rootInfo['ArchiveType'] !== "\x58\x44\x49\x41"){ // XDIA
36
+		if ($rootInfo['ArchiveType'] !== "\x58\x44\x49\x41") { // XDIA
37 37
 			throw new WSDBException('invalid AIDX');
38 38
 		}
39 39
 
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 		$files = \array_fill(0, $n['files'], null);
63 63
 
64 64
 		// create a directory object for each dir (4+4 = 8 bytes)
65
-		foreach($dirs as $i => $_){
65
+		foreach ($dirs as $i => $_) {
66 66
 			$dirs[$i] = new ArchiveDirectory(\unpack('LNameOffset/LBlockIndex', \fread($this->fh, 8)), $parent);
67 67
 		}
68 68
 
69 69
 		// create a file object for each file (4+4+8+8+8+20+4 = 56 bytes)
70
-		foreach($files as $i => $_){
70
+		foreach ($files as $i => $_) {
71 71
 			$files[$i] = new ArchiveFile(
72 72
 				\unpack('LNameOffset/LFlags/QFiletime/QSizeUncompressed/QSizeCompressed/a20Hash/x4', \fread($this->fh, 56)),
73 73
 				$parent
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
 		// apply the names to each object in the block
81 81
 		$setnames = function(array &$arr) use ($names):void{
82
-			foreach($arr ?? [] as $i => $e){
82
+			foreach ($arr ?? [] as $i => $e) {
83 83
 				$arr[$i]->Name = \DIRECTORY_SEPARATOR.
84 84
 					\substr($names, $e->NameOffset, \strpos($names, "\x00", $e->NameOffset) - $e->NameOffset);
85 85
 			}
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 		$setnames($files);
90 90
 
91 91
 		// loop through the directory stucture recursively and add the block data
92
-		foreach($dirs as $i => $info){
93
-			if(isset($this->blocktable[$info->BlockIndex])){
92
+		foreach ($dirs as $i => $info) {
93
+			if (isset($this->blocktable[$info->BlockIndex])) {
94 94
 				$dirs[$i]->Content = $this->getBlock($this->blocktable[$info->BlockIndex], $parent.$info->Name);
95 95
 			}
96 96
 		}
Please login to merge, or discard this patch.
src/AARCReader.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 namespace codemasher\WildstarDB;
14 14
 
15
-class AARCReader extends PACKReaderAbstract{
15
+class AARCReader extends PACKReaderAbstract {
16 16
 
17 17
 	/**
18 18
 	 * @throws \codemasher\WildstarDB\WSDBException
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			\fread($this->fh, $this->blocktable[$this->header['RootInfoIndex']]['Size'])
26 26
 		);
27 27
 
28
-		if($rootInfo['ArchiveType'] !== "\x43\x52\x41\x41"){ // CRAA
28
+		if ($rootInfo['ArchiveType'] !== "\x43\x52\x41\x41") { // CRAA
29 29
 			throw new WSDBException('invalid AARC');
30 30
 		}
31 31
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		\fseek($this->fh, $blockInfo['Offset']);
36 36
 
37 37
 		// read the data block info (4+20+8 = 32 bytes)
38
-		for($i = 0; $i < $rootInfo['Blockcount']; $i++){
38
+		for ($i = 0; $i < $rootInfo['Blockcount']; $i++) {
39 39
 			$data = unpack('LIndex/a20Hash/QSizeUncompressed', \fread($this->fh, 32));
40 40
 			$hash = \bin2hex($data['Hash']);
41 41
 			unset($data['Hash']);
Please login to merge, or discard this patch.
src/ArchiveDirectory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
 namespace codemasher\WildstarDB;
14 14
 
15
-class ArchiveDirectory extends ArchiveItemAbstract{
15
+class ArchiveDirectory extends ArchiveItemAbstract {
16 16
 
17 17
 	public $BlockIndex;
18 18
 	public $Content;
Please login to merge, or discard this patch.
src/ArchiveItemAbstract.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,15 +12,15 @@
 block discarded – undo
12 12
 
13 13
 namespace codemasher\WildstarDB;
14 14
 
15
-abstract class ArchiveItemAbstract{
15
+abstract class ArchiveItemAbstract {
16 16
 
17 17
 	public $Parent;
18 18
 	public $Name;
19 19
 	public $NameOffset;
20 20
 
21
-	public function __construct(array $data, string $parent){
21
+	public function __construct(array $data, string $parent) {
22 22
 
23
-		foreach($data as $property => $value){
23
+		foreach ($data as $property => $value) {
24 24
 			$this->{$property} = $value;
25 25
 		}
26 26
 
Please login to merge, or discard this patch.
src/PACKReaderAbstract.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 /**
18 18
  * @property array $blocktable
19 19
  */
20
-abstract class PACKReaderAbstract extends ReaderAbstract{
20
+abstract class PACKReaderAbstract extends ReaderAbstract {
21 21
 
22 22
 	/**
23 23
 	 * @var string
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 		$this->loadFile($filename);
49 49
 		$this->blocktable = [];
50 50
 
51
-		if($this->header['Signature'] !== "\x4b\x43\x41\x50"){ // KCAP
51
+		if ($this->header['Signature'] !== "\x4b\x43\x41\x50") { // KCAP
52 52
 			throw new WSDBException('invalid PACK');
53 53
 		}
54 54
 
55 55
 		// read the block info table
56 56
 		\fseek($this->fh, $this->header['BlockTableOffset']);
57 57
 
58
-		for($i = 0; $i < $this->header['BlockCount']; $i++){
58
+		for ($i = 0; $i < $this->header['BlockCount']; $i++) {
59 59
 			$this->blocktable[$i] = \unpack('QOffset/QSize', \fread($this->fh, 16));
60 60
 		}
61 61
 
Please login to merge, or discard this patch.