Completed
Pull Request — master (#51)
by Robbie
01:35
created
tests/DataExtractor/CsvTableWriterTest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
 		$csv = new CsvTableWriter('/tmp/output.csv');
14 14
 
15 15
 		$csv->start(['Col1', 'Col2', 'Col3']);
16
-		$csv->writeRecord([ 'Col1' => 'One', 'Col2' => 2, 'Col3' => 'Three' ]);
17
-		$csv->writeRecord([ 'Col1' => 'Hello, Sam', 'Col2' => 5, 'Col3' => "Nice to meet you\nWhat is your name?" ]);
16
+		$csv->writeRecord(['Col1' => 'One', 'Col2' => 2, 'Col3' => 'Three']);
17
+		$csv->writeRecord(['Col1' => 'Hello, Sam', 'Col2' => 5, 'Col3' => "Nice to meet you\nWhat is your name?"]);
18 18
 		$csv->finish();
19 19
 
20 20
 		$csvContent = file_get_contents('/tmp/output.csv');
21 21
 		unlink('/tmp/output.csv');
22 22
 
23
-		$fixture = file_get_contents(__DIR__ . '/fixture/input.csv');
23
+		$fixture = file_get_contents(__DIR__.'/fixture/input.csv');
24 24
 
25 25
 		$this->assertEquals($fixture, $csvContent);
26 26
 	}
@@ -33,14 +33,14 @@  discard block
 block discarded – undo
33 33
 
34 34
 		$csv = new CsvTableWriter('/tmp/output.csv');
35 35
 
36
-		$csv->writeRecord([ 'Col1' => 'One', 'Col2' => 2, 'Col3' => 'Three' ]);
37
-		$csv->writeRecord([ 'Col1' => 'Hello, Sam', 'Col2' => 5, 'Col3' => "Nice to meet you\nWhat is your name?" ]);
36
+		$csv->writeRecord(['Col1' => 'One', 'Col2' => 2, 'Col3' => 'Three']);
37
+		$csv->writeRecord(['Col1' => 'Hello, Sam', 'Col2' => 5, 'Col3' => "Nice to meet you\nWhat is your name?"]);
38 38
 		$csv->finish();
39 39
 
40 40
 		$csvContent = file_get_contents('/tmp/output.csv');
41 41
 		unlink('/tmp/output.csv');
42 42
 
43
-		$fixture = file_get_contents(__DIR__ . '/fixture/input.csv');
43
+		$fixture = file_get_contents(__DIR__.'/fixture/input.csv');
44 44
 
45 45
 		$this->assertEquals($fixture, $csvContent);
46 46
 	}
Please login to merge, or discard this patch.
tests/SmokeTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-define('PACKAGE_ROOT' , dirname(__DIR__).'/');
4
-require_once(PACKAGE_ROOT . 'src/SSPak.php');
3
+define('PACKAGE_ROOT', dirname(__DIR__).'/');
4
+require_once(PACKAGE_ROOT.'src/SSPak.php');
5 5
 
6 6
 /**
7 7
  * Confirm that the compile binary executes
Please login to merge, or discard this patch.
src/SSPakFile.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@  discard block
 block discarded – undo
8 8
 
9 9
 	function __construct($path, $executor, $pharAlias = 'sspak.phar') {
10 10
 		parent::__construct($path, $executor);
11
-		if(!$this->isLocal()) throw new LogicException("Can't manipulate remote .sspak.phar files, only remote webroots.");
11
+		if (!$this->isLocal()) throw new LogicException("Can't manipulate remote .sspak.phar files, only remote webroots.");
12 12
 
13 13
 		$this->pharAlias = $pharAlias;
14 14
 		$this->pharPath = $path;
15 15
 
16 16
 		// Executable Phar version
17
-		if(substr($path,-5) === '.phar') {
17
+		if (substr($path, -5) === '.phar') {
18 18
 			$this->phar = new Phar($path, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME,
19 19
 				$this->pharAlias);
20
-			if(!file_exists($this->path)) $this->makeExecutable();
20
+			if (!file_exists($this->path)) $this->makeExecutable();
21 21
 
22 22
 		// Non-executable Tar version
23 23
 		} else {
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	 * Add the SSPak executable information into this SSPak file
35 35
 	 */
36 36
 	function makeExecutable() {
37
-		if(ini_get('phar.readonly')) {
37
+		if (ini_get('phar.readonly')) {
38 38
 			throw new Exception("Please set phar.readonly to false in your php.ini.");
39 39
 		}
40 40
 
41
-		passthru("composer install -d " . escapeshellarg(PACKAGE_ROOT) . " --no-dev");
41
+		passthru("composer install -d ".escapeshellarg(PACKAGE_ROOT)." --no-dev");
42 42
 
43 43
 		$root = PACKAGE_ROOT;
44 44
 		$srcRoots = [
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 		];
48 48
 
49 49
 		// Add the bin file, but strip of the #! exec header.
50
-		$this->phar['bin/sspak'] = preg_replace("/^#!\/usr\/bin\/env php\n/", '', file_get_contents($root . "bin/sspak"));
50
+		$this->phar['bin/sspak'] = preg_replace("/^#!\/usr\/bin\/env php\n/", '', file_get_contents($root."bin/sspak"));
51 51
 
52
-		foreach($srcRoots as $srcRoot) {
53
-			foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root . $srcRoot)) as $fileObj) {
54
-				if($fileObj->isFile()) {
52
+		foreach ($srcRoots as $srcRoot) {
53
+			foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($root.$srcRoot)) as $fileObj) {
54
+				if ($fileObj->isFile()) {
55 55
 					$file = $fileObj->getRealPath();
56 56
 
57 57
 					$relativeFile = str_replace($root, '', $file);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		$this->phar->setStub($stub);
75 75
 		chmod($this->path, 0775);
76 76
 
77
-		passthru("composer install -d " . escapeshellarg(PACKAGE_ROOT));
77
+		passthru("composer install -d ".escapeshellarg(PACKAGE_ROOT));
78 78
 	}
79 79
 
80 80
 	/**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		// Non-executable Phars can't have content streamed into them
104 104
 		// This means that we need to create a temp file, which is a pain, if that file happens to be a 3GB
105 105
 		// asset dump. :-/
106
-		if($this->phar instanceof PharData) {
107
-			$tmpFile = '/tmp/sspak-content-' .rand(100000,999999);
106
+		if ($this->phar instanceof PharData) {
107
+			$tmpFile = '/tmp/sspak-content-'.rand(100000, 999999);
108 108
 			$process->exec(array('outputFile' => $tmpFile));
109 109
 			$this->phar->addFile($tmpFile, $filename);
110 110
 			unlink($tmpFile);
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @return Stream context
124 124
 	 */
125 125
 	function writeStreamForFile($filename) {
126
-		return fopen('phar://' . $this->pharAlias . '/' . $filename, 'w');
126
+		return fopen('phar://'.$this->pharAlias.'/'.$filename, 'w');
127 127
 	}
128 128
 
129 129
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	function readStreamForFile($filename) {
135 135
 		// Note: using pharAlias here doesn't work on Debian Wheezy (nor on Windows for that matter).
136 136
 		//return fopen('phar://' . $this->pharAlias . '/' . $filename, 'r');
137
-		return fopen('phar://' . $this->pharPath . '/' . $filename, 'r');
137
+		return fopen('phar://'.$this->pharPath.'/'.$filename, 'r');
138 138
 	}
139 139
 
140 140
 	/**
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 	function gitRemoteDetails() {
154 154
 		$content = $this->content('git-remote');
155 155
 		$details = array();
156
-		foreach(explode("\n", trim($content)) as $line) {
157
-			if(!$line) continue;
156
+		foreach (explode("\n", trim($content)) as $line) {
157
+			if (!$line) continue;
158 158
 
159
-			if(preg_match('/^([^ ]+) *= *(.*)$/', $line, $matches)) {
159
+			if (preg_match('/^([^ ]+) *= *(.*)$/', $line, $matches)) {
160 160
 				$details[$matches[1]] = $matches[2];
161 161
 			} else {
162 162
 				throw new Exception("Bad line '$line'");
Please login to merge, or discard this patch.