Completed
Push — master ( 2a03e3...273839 )
by Damian
9s
created
src/Args.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 	public function __construct($args) {
12 12
 		array_shift($args);
13 13
 
14
-		foreach($args as $arg) {
15
-			if(preg_match('/^--([^=]+)=(.*)$/', $arg, $matches)) {
14
+		foreach ($args as $arg) {
15
+			if (preg_match('/^--([^=]+)=(.*)$/', $arg, $matches)) {
16 16
 				$this->namedArgs[$matches[1]] = $matches[2];
17
-			} else if(preg_match('/^--([^=]+)$/', $arg, $matches)) {
17
+			} else if (preg_match('/^--([^=]+)$/', $arg, $matches)) {
18 18
 				$this->namedArgs[$matches[1]] = true;
19 19
 			} else {
20 20
 				$this->unnamedArgs[] = $arg;
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	 * Return the sudo argument, preferring a more specific one with the given optional prefix
52 52
 	 */
53 53
 	public function sudo($optionalPrefix) {
54
-		if(!empty($this->namedArgs[$optionalPrefix . '-sudo'])) return $this->namedArgs[$optionalPrefix . '-sudo'];
55
-		else if(!empty($this->namedArgs['sudo'])) return $this->namedArgs['sudo'];
54
+		if (!empty($this->namedArgs[$optionalPrefix.'-sudo'])) return $this->namedArgs[$optionalPrefix.'-sudo'];
55
+		else if (!empty($this->namedArgs['sudo'])) return $this->namedArgs['sudo'];
56 56
 		else return null;
57 57
 	}
58 58
 
@@ -62,18 +62,18 @@  discard block
 block discarded – undo
62 62
 	public function pakParts() {
63 63
 		// Look up which parts of the sspak are going to be saved
64 64
 		$pakParks = array();
65
-		foreach(array('assets','db','git-remote') as $part) {
65
+		foreach (array('assets', 'db', 'git-remote') as $part) {
66 66
 			$pakParts[$part] = !empty($this->namedArgs[$part]);
67 67
 		}
68 68
 
69 69
 		// Default to db and assets
70
-		if(!array_filter($pakParts)) $pakParts = array('db' => true, 'assets' => true, 'git-remote' => true);
70
+		if (!array_filter($pakParts)) $pakParts = array('db' => true, 'assets' => true, 'git-remote' => true);
71 71
 		return $pakParts;
72 72
 	}
73 73
 
74 74
 	public function requireUnnamed($items) {
75
-		if(sizeof($this->unnamedArgs) < sizeof($items)) {
76
-			echo "Usage: {$_SERVER['argv'][0]} " . $this->action . " (";
75
+		if (sizeof($this->unnamedArgs) < sizeof($items)) {
76
+			echo "Usage: {$_SERVER['argv'][0]} ".$this->action." (";
77 77
 			echo implode(") (", $items);
78 78
 			echo ")\n";
79 79
 			throw new Exception('Arguments missing.');
Please login to merge, or discard this patch.
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,9 +51,13 @@  discard block
 block discarded – undo
51 51
 	 * Return the sudo argument, preferring a more specific one with the given optional prefix
52 52
 	 */
53 53
 	public function sudo($optionalPrefix) {
54
-		if(!empty($this->namedArgs[$optionalPrefix . '-sudo'])) return $this->namedArgs[$optionalPrefix . '-sudo'];
55
-		else if(!empty($this->namedArgs['sudo'])) return $this->namedArgs['sudo'];
56
-		else return null;
54
+		if(!empty($this->namedArgs[$optionalPrefix . '-sudo'])) {
55
+			return $this->namedArgs[$optionalPrefix . '-sudo'];
56
+		} else if(!empty($this->namedArgs['sudo'])) {
57
+			return $this->namedArgs['sudo'];
58
+		} else {
59
+			return null;
60
+		}
57 61
 	}
58 62
 
59 63
 	/**
@@ -67,7 +71,9 @@  discard block
 block discarded – undo
67 71
 		}
68 72
 
69 73
 		// Default to db and assets
70
-		if(!array_filter($pakParts)) $pakParts = array('db' => true, 'assets' => true, 'git-remote' => true);
74
+		if(!array_filter($pakParts)) {
75
+			$pakParts = array('db' => true, 'assets' => true, 'git-remote' => true);
76
+		}
71 77
 		return $pakParts;
72 78
 	}
73 79
 
Please login to merge, or discard this patch.
tests/DataExtractor/CsvTableReaderTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,18 +6,18 @@
 block discarded – undo
6 6
 {
7 7
 	public function testCsvReading() {
8 8
 
9
-		$csv = new CsvTableReader(__DIR__ . '/fixture/input.csv');
9
+		$csv = new CsvTableReader(__DIR__.'/fixture/input.csv');
10 10
 		$this->assertEquals(['Col1', 'Col2', 'Col3'], $csv->getColumns());
11 11
 
12 12
 		$extractedData = [];
13
-		foreach($csv as $record) {
13
+		foreach ($csv as $record) {
14 14
 			$extractedData[] = $record;
15 15
 		}
16 16
 
17 17
 		$this->assertEquals(
18 18
 			[
19
-				[ 'Col1' => 'One', 'Col2' => 2, 'Col3' => 'Three' ],
20
-				[ 'Col1' => 'Hello, Sam', 'Col2' => 5, 'Col3' => "Nice to meet you\nWhat is your name?" ]
19
+				['Col1' => 'One', 'Col2' => 2, 'Col3' => 'Three'],
20
+				['Col1' => 'Hello, Sam', 'Col2' => 5, 'Col3' => "Nice to meet you\nWhat is your name?"]
21 21
 			],
22 22
 			$extractedData
23 23
 		);
Please login to merge, or discard this patch.
src/sspak-sniffer.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@
 block discarded – undo
13 13
 }
14 14
 
15 15
 $basePath = $_SERVER['argv'][1];
16
-if($basePath[0] != '/') $basePath = getcwd() . '/' . $basePath;
16
+if($basePath[0] != '/') {
17
+	$basePath = getcwd() . '/' . $basePath;
18
+}
17 19
 
18 20
 // SilverStripe bootstrap
19 21
 define('BASE_PATH', realpath($basePath));
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Argument parsing
10
-if(empty($_SERVER['argv'][1])) {
10
+if (empty($_SERVER['argv'][1])) {
11 11
 	echo "Usage: {$_SERVER['argv'][0]} (site-docroot)\n";
12 12
 	exit(1);
13 13
 }
14 14
 
15 15
 $basePath = $_SERVER['argv'][1];
16
-if($basePath[0] != '/') $basePath = getcwd() . '/' . $basePath;
16
+if ($basePath[0] != '/') $basePath = getcwd().'/'.$basePath;
17 17
 
18 18
 // SilverStripe bootstrap
19 19
 define('BASE_PATH', realpath($basePath));
@@ -23,15 +23,15 @@  discard block
 block discarded – undo
23 23
 $_SERVER['HTTP_HOST'] = 'localhost';
24 24
 chdir(BASE_PATH);
25 25
 
26
-if(file_exists(BASE_PATH.'/sapphire/core/Core.php')) {
26
+if (file_exists(BASE_PATH.'/sapphire/core/Core.php')) {
27 27
 	//SS 2.x
28
-	require_once(BASE_PATH . '/sapphire/core/Core.php');
29
-} else if(file_exists(BASE_PATH.'/framework/core/Core.php')) {
28
+	require_once(BASE_PATH.'/sapphire/core/Core.php');
29
+} else if (file_exists(BASE_PATH.'/framework/core/Core.php')) {
30 30
 	//SS 3.x
31
-	require_once(BASE_PATH. '/framework/core/Core.php');
32
-} else if(file_exists(BASE_PATH.'/vendor/silverstripe/framework')) {
31
+	require_once(BASE_PATH.'/framework/core/Core.php');
32
+} else if (file_exists(BASE_PATH.'/vendor/silverstripe/framework')) {
33 33
 	//SS 4.x
34
-	require_once(BASE_PATH. '/vendor/autoload.php');
34
+	require_once(BASE_PATH.'/vendor/autoload.php');
35 35
 	$kernel = new SilverStripe\Core\CoreKernel(BASE_PATH);
36 36
 	//boot the parts of the kernel to populate the DB config
37 37
 	foreach (array('bootDatabaseEnvVars', 'bootDatabaseGlobals') as $bootMethod) {
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 	}
42 42
 	$databaseConfig = SilverStripe\ORM\DB::getConfig();
43 43
 } else {
44
-	echo "Couldn't locate framework's Core.php. Perhaps " . BASE_PATH . " is not a SilverStripe project?\n";
44
+	echo "Couldn't locate framework's Core.php. Perhaps ".BASE_PATH." is not a SilverStripe project?\n";
45 45
 	exit(2);
46 46
 }
47 47
 
48 48
 $output = array();
49
-foreach($databaseConfig as $k => $v) {
50
-	$output['db_' . $k] = $v;
49
+foreach ($databaseConfig as $k => $v) {
50
+	$output['db_'.$k] = $v;
51 51
 }
52 52
 $output['assets_path'] = ASSETS_PATH;
53 53
 
Please login to merge, or discard this patch.