Passed
Push — master ( 693d98...8cf93f )
by Tom
02:05
created
maphper/datasource/mysqladapter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		return;
97 97
 
98 98
 		$runAgain = false;
99
-		$columns = $this->pdo->query('SELECT * FROM '. $this->quote($table) . ' PROCEDURE ANALYSE(1,1)')->fetchAll(\PDO::FETCH_OBJ);
99
+		$columns = $this->pdo->query('SELECT * FROM ' . $this->quote($table) . ' PROCEDURE ANALYSE(1,1)')->fetchAll(\PDO::FETCH_OBJ);
100 100
 		foreach ($columns as $column) {
101 101
 			$parts = explode('.', $column->Field_name);
102 102
 			$name = $this->quote(end($parts));
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 					}
131 131
 				}
132 132
 
133
-				$this->pdo->query('ALTER TABLE ' . $this->quote($table) . ' MODIFY '. $name . ' ' . $type);
133
+				$this->pdo->query('ALTER TABLE ' . $this->quote($table) . ' MODIFY ' . $name . ' ' . $type);
134 134
 			}
135 135
 		}
136 136
 		//Sometimes a second pass is needed, if a column has gone from varchar -> int(11) a better int type may be needed
Please login to merge, or discard this patch.
maphper/datasource/database.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		if (isset($options['fields'])) $this->fields = implode(',', array_map([$this->adapter, 'quote'], $options['fields']));
30 30
 		$this->defaultSort = (isset($options['defaultSort'])) ? $options['defaultSort'] : implode(', ', $this->primaryKey);
31 31
 		if (isset($options['editmode'])) $this->alterDb = $options['editmode'] == true ? self::EDIT_STRUCTURE | self::EDIT_INDEX | self::EDIT_OPTIMISE : $options['editmode'];
32
-		if (self::EDIT_OPTIMISE & $this->alterDb && rand(0,500) == 1) $this->adapter->optimiseColumns($table);
32
+		if (self::EDIT_OPTIMISE & $this->alterDb && rand(0, 500) == 1) $this->adapter->optimiseColumns($table);
33 33
 	}
34 34
 
35 35
 	private function getAdapter(\PDO $pdo) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		//Something has changed, clear any cached results as they may now be incorrect
169 169
 		$this->resultCache = [];
170 170
 		$pkValue = $data->{$this->primaryKey[0]};
171
-		if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object) array_merge((array)$this->cache[$pkValue], (array)$data);
171
+		if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object)array_merge((array)$this->cache[$pkValue], (array)$data);
172 172
 		else $this->cache[$pkValue] = $data;
173 173
 	}
174 174
 
Please login to merge, or discard this patch.
maphper/datasource/mock.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
     }
34 34
 
35 35
     private function getSearchFieldFunction($fields, $mode) {
36
-        return function ($data) use ($fields, $mode) {
36
+        return function($data) use ($fields, $mode) {
37 37
             foreach ($fields as $key => $val) {
38 38
                 $currentFieldResult = $this->getIfFieldMatches($key, $val, $data, $mode);
39 39
 
Please login to merge, or discard this patch.
maphper/datasource/sqliteadapter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 		
24 24
 		$args = $query->getArgs();
25 25
 		foreach ($args as &$arg) if ($arg instanceof \DateTime) {
26
-			if ($arg->format('H:i:s')  == '00:00:00') $arg = $arg->format('Y-m-d');
26
+			if ($arg->format('H:i:s') == '00:00:00') $arg = $arg->format('Y-m-d');
27 27
 			else $arg = $arg->format('Y-m-d H:i:s');
28 28
 		}
29 29
 				
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	}
64 64
 
65 65
 	private function tableExists($name) {
66
-		$result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="'. $name.'"');
66
+		$result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="' . $name . '"');
67 67
 		return count($result->fetchAll()) == 1;
68 68
 	}
69 69
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 		// SQLSTATE[HY000]: General error: 17 database schema has changed
83 83
 		$this->queryCache = [];
84 84
 
85
-		$affix = '_'.substr(md5($table), 0, 6);
85
+		$affix = '_' . substr(md5($table), 0, 6);
86 86
 		$this->createTable($table . $affix, $primaryKey, $data);
87 87
 		$fields = [];
88 88
 		foreach ($data as $key => $value) { $fields[] = $key; }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 				$columns = implode(', ', $this->getColumns($table));			
92 92
 
93 93
 				$this->pdo->query('INSERT INTO ' . $this->quote($table . $affix) . '(' . $columns . ') SELECT ' . $columns . ' FROM ' . $this->quote($table));
94
-				$this->pdo->query('DROP TABLE IF EXISTS ' . $table );
94
+				$this->pdo->query('DROP TABLE IF EXISTS ' . $table);
95 95
 			}
96 96
 		}
97 97
 		catch (\PDOException $e) {
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 			echo $e->getMessage();
100 100
 		}
101 101
 
102
-		$this->pdo->query('DROP TABLE IF EXISTS ' . $table );
103
-		$this->pdo->query('ALTER TABLE ' . $table . $affix. ' RENAME TO '. $table );
102
+		$this->pdo->query('DROP TABLE IF EXISTS ' . $table);
103
+		$this->pdo->query('ALTER TABLE ' . $table . $affix . ' RENAME TO ' . $table);
104 104
 
105 105
 	}
106 106
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 		
115 115
 		$pkField = implode(', ', $parts) . ', PRIMARY KEY(' . implode(', ', $primaryKey) . ')';
116 116
 				
117
-		$this->pdo->query('DROP TABLE IF EXISTS ' . $table );
117
+		$this->pdo->query('DROP TABLE IF EXISTS ' . $table);
118 118
 		$this->pdo->query('CREATE TABLE ' . $table . ' (' . $pkField . ')');
119 119
 					
120 120
 		foreach ($data as $key => $value) {
Please login to merge, or discard this patch.
maphper/lib/selectbuilder.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	//Needs to be broken up into better methods
28
-	public function createSql($fields, $mode){
28
+	public function createSql($fields, $mode) {
29 29
 		$args = [];
30 30
 		$sql = [];
31 31
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 					$inSql[] = ':' . $key . $i;
51 51
 				}
52 52
 				if (count($inSql) == 0) return [];
53
-				else $sql[] = $key . ' IN ( ' .  implode(', ', $inSql) . ')';
53
+				else $sql[] = $key . ' IN ( ' . implode(', ', $inSql) . ')';
54 54
 			}
55 55
 			else if ($value === NULL) {
56 56
 				$nullSql = $key . ' IS ';
Please login to merge, or discard this patch.
maphper/lib/visibilityoverride.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 	public function __construct() {
8 8
 		$this->readClosure = function() {
9 9
 			$data = new \stdClass;
10
-			foreach ($this as $k => $v)	{
10
+			foreach ($this as $k => $v) {
11 11
 				if (is_scalar($v) || is_null($v) || (is_object($v) && $v instanceof \DateTime))	$data->$k = $v;
12 12
 			}
13 13
 			return $data;
Please login to merge, or discard this patch.
maphper/lib/crudbuilder.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@  discard block
 block discarded – undo
19 19
 			//For dates with times set, search on time, if the time is not set, search on date only.
20 20
 			//E.g. searching for all records posted on '2015-11-14' should return all records that day, not just the ones posted at 00:00:00 on that day
21 21
 			if ($value instanceof \DateTime) {
22
-				if ($value->format('H:i:s')  == '00:00:00') $value = $value->format('Y-m-d');
22
+				if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d');
23 23
 				else $value = $value->format('Y-m-d H:i:s');
24 24
 			}
25 25
 			if (is_object($value)) continue;
26
-			if ($prependField){
26
+			if ($prependField) {
27 27
 				$sql[] = $this->quote($field) . ' = :' . $field;
28 28
 			} else {
29 29
 				$sql[] = ':' . $field;
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 
36 36
 	public function insert($table, $data) {
37 37
 		$query = $this->buildSaveQuery($data);
38
-		return new Query('INSERT INTO ' . $this->quote($table) . ' (' .implode(', ', array_keys($query['args'])).') VALUES ( ' . implode(', ', $query['sql']). ' )', $query['args']);
38
+		return new Query('INSERT INTO ' . $this->quote($table) . ' (' . implode(', ', array_keys($query['args'])) . ') VALUES ( ' . implode(', ', $query['sql']) . ' )', $query['args']);
39 39
 	}
40 40
 
41 41
 	public function update($table, array $primaryKey, $data) {
42 42
 		$query = $this->buildSaveQuery($data, true);
43 43
 		$where = [];
44
-		foreach($primaryKey as $field) $where[] = $this->quote($field) . ' = :' . $field;
45
-		return new Query('UPDATE ' . $this->quote($table) . ' SET ' . implode(', ', $query['sql']). ' WHERE '. implode(' AND ', $where), $query['args']);
44
+		foreach ($primaryKey as $field) $where[] = $this->quote($field) . ' = :' . $field;
45
+		return new Query('UPDATE ' . $this->quote($table) . ' SET ' . implode(', ', $query['sql']) . ' WHERE ' . implode(' AND ', $where), $query['args']);
46 46
 	}
47 47
 }
Please login to merge, or discard this patch.
maphper/multipk.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	}
25 25
 
26 26
 	public function offsetGet($key) {
27
-		$depth = $this->getDepth()+1;
28
-		if (count($this->primaryKey)-1 == $depth) return $this->mapper->filter([$this->primaryKey[$depth] => $key])->item(0);
27
+		$depth = $this->getDepth() + 1;
28
+		if (count($this->primaryKey) - 1 == $depth) return $this->mapper->filter([$this->primaryKey[$depth] => $key])->item(0);
29 29
 		else return new MultiPk($this->mapper, $key, $this->primaryKey, $this);
30 30
 	}
31 31
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 	public function offsetUnset($key) {
46 46
 		$keys = $this->primaryKey;
47
-		$this->mapper->filter([ array_pop($keys) => $key])->delete();
47
+		$this->mapper->filter([array_pop($keys) => $key])->delete();
48 48
 	}
49 49
 
50 50
 	public function offsetExists($key) {
Please login to merge, or discard this patch.
maphper/relation/manymany.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	//bit hacky, breaking encapsulation, but simplest way to work out the info for the other side of the many:many relationship.
38 38
 	private function getOtherFieldNameInfo() {
39 39
 		if ($this->otherInfo == null) {
40
-			$propertyReader = function($name) {return $this->$name;	};
40
+			$propertyReader = function($name) {return $this->$name; };
41 41
 
42 42
 			$reader = $propertyReader->bindTo($this->intermediateMapper, $this->intermediateMapper);
43 43
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 				$propertyReader = $propertyReader->bindTo($relation, $relation);
46 46
 				if ($propertyReader('parentField') != $this->parentField) {
47 47
 					$relation = $relation->getData($this->object);
48
-					$this->otherInfo = [$propertyReader('localField'),  $propertyReader('parentField'), $propertyReader('mapper')];
48
+					$this->otherInfo = [$propertyReader('localField'), $propertyReader('parentField'), $propertyReader('mapper')];
49 49
 				}
50 50
 			}
51 51
 		}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		list($relatedField, $valueField, $mapper) = $this->getOtherFieldNameInfo();
89 89
 		if ($this->autoTraverse) {
90 90
 			$record = new \stdClass;
91
-			$record->{$this->parentField} =  $value->{$this->localField};
91
+			$record->{$this->parentField} = $value->{$this->localField};
92 92
 			$record->$valueField = $this->object->{$relatedField};
93 93
 			$this->intermediateMapper[] = $record;
94 94
 
Please login to merge, or discard this patch.