Passed
Push — master ( 453afa...4b6b7b )
by Tom
02:15
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/Database.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@
 block discarded – undo
16 16
 
17 17
 		$this->primaryKey = is_array($primaryKey) ? $primaryKey : [$primaryKey];
18 18
 
19
-		$this->fields = implode(',', array_map([$adapter, 'quote'], (array) $options->read('fields')));
19
+		$this->fields = implode(',', array_map([$adapter, 'quote'], (array)$options->read('fields')));
20 20
 
21
-		$defaultSort = $options->read('defaultSort') !== false ? $options->read('defaultSort')  : implode(', ', $this->primaryKey);
21
+		$defaultSort = $options->read('defaultSort') !== false ? $options->read('defaultSort') : implode(', ', $this->primaryKey);
22 22
 
23 23
         $databaseModify = new DatabaseModify($adapter, $options->getEditMode(), $table);
24 24
 
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/DataSource/DatabaseSelect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
     }
95 95
 
96 96
     public function updateCache($data, $pkValue) {
97
-		if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object) array_merge((array)$this->cache[$pkValue], (array)$data);
97
+		if (isset($this->cache[$pkValue])) $this->cache[$pkValue] = (object)array_merge((array)$this->cache[$pkValue], (array)$data);
98 98
 		else $this->cache[$pkValue] = $data;
99 99
     }
100 100
 
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/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.