Passed
Pull Request — master (#70)
by Christian
01:42 queued 19s
created
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/DataSource/DatabaseModify.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 	}
18 18
 
19 19
     public function optimizeColumns() {
20
-        if (Database::EDIT_OPTIMISE & $this->alterDb && rand(0,500) == 1) $this->adapter->optimiseColumns($this->table);
20
+        if (Database::EDIT_OPTIMISE & $this->alterDb && rand(0, 500) == 1) $this->adapter->optimiseColumns($this->table);
21 21
     }
22 22
 
23 23
     public function getTryInsertAgain($tryagain) {
Please login to merge, or discard this patch.
Maphper/DataSource/SqliteAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 
42 42
 	private function tableExists($name) {
43
-		$result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="'. $name.'"');
43
+		$result = $this->pdo->query('SELECT name FROM sqlite_master WHERE type="table" and name="' . $name . '"');
44 44
 		return count($result->fetchAll()) == 1;
45 45
 	}
46 46
 
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 		$this->stmtCache->clearCache();
61 61
 
62 62
         // Create temp table to create a new structure
63
-		$affix = '_'.substr(md5($table), 0, 6);
63
+		$affix = '_' . substr(md5($table), 0, 6);
64 64
         $tempTable = $table . $affix;
65 65
 		$this->generalEditor->createTable($tempTable, $primaryKey, $data);
66 66
         $this->alterColumns($tempTable, $primaryKey, $data);
67 67
 		$this->copyTableData($table, $tempTable);
68 68
 
69
-		$this->pdo->query('DROP TABLE IF EXISTS ' . $table );
70
-		$this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO '. $table );
69
+		$this->pdo->query('DROP TABLE IF EXISTS ' . $table);
70
+		$this->pdo->query('ALTER TABLE ' . $tempTable . ' RENAME TO ' . $table);
71 71
 
72 72
 	}
73 73
 
Please login to merge, or discard this patch.
Maphper/Maphper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Maphper;
3 3
 class Maphper implements \Countable, \ArrayAccess, \IteratorAggregate {
4
-	const FIND_EXACT 		= 	0x1;
5
-	const FIND_LIKE 		= 	0x2;
6
-	const FIND_STARTS 		= 	0x4;
7
-	const FIND_ENDS 		= 	0x8;
8
-	const FIND_BIT 			= 	0x10;
9
-	const FIND_GREATER 		= 	0x20;
10
-	const FIND_LESS 		=	0x40;
11
-	const FIND_EXPRESSION 	= 	0x80;
12
-	const FIND_AND 			= 	0x100;
13
-	const FIND_OR 			= 	0x200;
14
-	const FIND_NOT 			= 	0x400;
15
-	const FIND_BETWEEN		= 	0x800;
16
-	const FIND_NOCASE		= 	0x1000;
4
+	const FIND_EXACT = 0x1;
5
+	const FIND_LIKE 		= 0x2;
6
+	const FIND_STARTS = 0x4;
7
+	const FIND_ENDS 		= 0x8;
8
+	const FIND_BIT 			= 0x10;
9
+	const FIND_GREATER = 0x20;
10
+	const FIND_LESS 		= 0x40;
11
+	const FIND_EXPRESSION = 0x80;
12
+	const FIND_AND 			= 0x100;
13
+	const FIND_OR = 0x200;
14
+	const FIND_NOT 			= 0x400;
15
+	const FIND_BETWEEN = 0x800;
16
+	const FIND_NOCASE		= 0x1000;
17 17
 
18 18
 	private $dataSource;
19 19
 	private $relations = [];
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 			}
58 58
 		}
59 59
 		$results = $this->dataSource->findByField($this->settings['filter'],
60
-			['order' => $this->settings['sort'], 'limit' => $this->settings['limit'], 'offset' => $this->settings['offset'] ]);
60
+			['order' => $this->settings['sort'], 'limit' => $this->settings['limit'], 'offset' => $this->settings['offset']]);
61 61
 
62 62
 		$siblings = new \ArrayObject();
63 63
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
109 109
             return isset($data[0]);
110 110
         }
111
-		return (bool) $this->dataSource->findById($offset);
111
+		return (bool)$this->dataSource->findById($offset);
112 112
 	}
113 113
 
114 114
 	public function offsetUnset($id) {
Please login to merge, or discard this patch.
Maphper/Lib/VisibilityOverride.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public function __construct($object) {
9 9
 		if ($object instanceof \stdclass) {
10
-			$this->readClosure = function() use ($object) { return $object;	};
11
-			$this->writeClosure = function ($field, $value) use ($object) { $object->$field = $value; };
10
+			$this->readClosure = function() use ($object) { return $object; };
11
+			$this->writeClosure = function($field, $value) use ($object) { $object->$field = $value; };
12 12
 		}
13 13
 		else {
14 14
             $visOverride = $this;
15 15
 			$this->readClosure = function() use ($visOverride) {
16
-                return (object) array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']);
16
+                return (object)array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']);
17 17
 			};
18 18
 			$this->readClosure = $this->readClosure->bindTo($object, $object);
19 19
 
20
-			$this->writeClosure = function ($field, $value) { $this->$field = $value; };
20
+			$this->writeClosure = function($field, $value) { $this->$field = $value; };
21 21
 			$this->writeClosure = $this->writeClosure->bindTo($object, $object);
22 22
 		}
23 23
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	public function write($data) {
35 35
 		if ($data != null) {
36 36
 			foreach ($data as $key => $value) {
37
-				($this->writeClosure)($key,  $this->processDates($value));
37
+				($this->writeClosure)($key, $this->processDates($value));
38 38
 			}
39 39
 		}
40 40
 	}
Please login to merge, or discard this patch.
Maphper/Lib/Entity.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
 	}
27 27
 
28 28
     private function addRelationData($object, $name, $relation, $siblings) {
29
-        if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation) ) {
29
+        if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation)) {
30 30
             //After overwriting the relation, does the parent object ($object) need overwriting as well?
31 31
             if ($relation->overwrite($object, $object->$name)) $this->parent[] = $object;
32 32
         }
Please login to merge, or discard this patch.
Maphper/Lib/ArrayFilter.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/Lib/Sql/WhereBuilder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 
81 81
     private function convertDates($value) {
82 82
         if ($value instanceof \DateTimeInterface) {
83
-            if ($value->format('H:i:s')  == '00:00:00') $value = $value->format('Y-m-d');
83
+            if ($value->format('H:i:s') == '00:00:00') $value = $value->format('Y-m-d');
84 84
             else $value = $value->format('Y-m-d H:i:s');
85 85
         }
86 86
         return $value;
Please login to merge, or discard this patch.
Maphper/Optimiser/MySql.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.