Passed
Push — master ( 8885c8...8f5295 )
by Tom
01:55
created
Maphper/Iterator.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@
 block discarded – undo
20 20
 		if (count($this->pk) == 1) {
21 21
 			$pk = end($this->pk);
22 22
 			return $this->array[$this->iterator]->$pk;
23
-		}
24
-		else {
23
+		} else {
25 24
 			$current = $this->current();
26 25
 			return array_map(function($pkName) use ($current) {
27 26
 				return $current->$pkName;
Please login to merge, or discard this patch.
Maphper/Lib/SelectBuilder.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,17 +7,23 @@
 block discarded – undo
7 7
 
8 8
 		if (isset($options['offset'])) {
9 9
 			$offset = ' OFFSET ' . $options['offset'];
10
-			if (!$limit) $limit = ' LIMIT  1000';
10
+			if (!$limit) {
11
+				$limit = ' LIMIT  1000';
12
+			}
13
+		} else {
14
+			$offset = '';
11 15
 		}
12
-		else $offset = '';
13 16
 
14 17
 		$order = isset($options['order']) ? ' ORDER BY ' . $options['order'] : '';
15 18
 		return new Query('SELECT * FROM ' . $table . ' ' . $where . $order . $limit . $offset, $args);
16 19
 	}
17 20
 
18 21
 	public function aggregate($table, $function, $field, $where, $args, $group) {
19
-		if ($group == true) $groupBy = ' GROUP BY ' . $field;
20
-		else $groupBy = '';
22
+		if ($group == true) {
23
+			$groupBy = ' GROUP BY ' . $field;
24
+		} else {
25
+			$groupBy = '';
26
+		}
21 27
 		return new Query('SELECT ' . $function . '(' . $field . ') as val, ' . $field . '   FROM ' . $table . ($where != null ? ' WHERE ' . $where : '') . ' ' . $groupBy, $args);
22 28
 	}
23 29
 }
Please login to merge, or discard this patch.
Maphper/Lib/VisibilityOverride.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 			$this->writeClosure = function ($field, $value) use ($object) { $object->$field = $value; };
12 12
 		}
13 13
 		else {
14
-            $visOverride = $this;
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
 
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 	}
25 25
 
26
-    public function isReturnableDataType($v) {
27
-        return is_scalar($v) || is_null($v) || (is_object($v) && $v instanceof \DateTime);
28
-    }
26
+	public function isReturnableDataType($v) {
27
+		return is_scalar($v) || is_null($v) || (is_object($v) && $v instanceof \DateTime);
28
+	}
29 29
 
30 30
 	public function getProperties() {
31 31
 		return ($this->readClosure)();
Please login to merge, or discard this 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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,8 +9,7 @@
 block discarded – undo
9 9
 		if ($object instanceof \stdclass) {
10 10
 			$this->readClosure = function() use ($object) { return $object;	};
11 11
 			$this->writeClosure = function ($field, $value) use ($object) { $object->$field = $value; };
12
-		}
13
-		else {
12
+		} else {
14 13
             $visOverride = $this;
15 14
 			$this->readClosure = function() use ($visOverride) {
16 15
                 return (object) array_filter(get_object_vars($this), [$visOverride, 'isReturnableDataType']);
Please login to merge, or discard this patch.
Maphper/Lib/Entity.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 	private $parent;
9 9
 
10 10
 	public function __construct(\Maphper\Maphper $parent, $className = null) {
11
-        $this->parent = $parent;
11
+		$this->parent = $parent;
12 12
 		$this->className = $className;
13 13
 	}
14 14
 
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 		return $object;
26 26
 	}
27 27
 
28
-    private function addRelationData($object, $name, $relation, $siblings) {
29
-        if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation) ) {
30
-            //After overwriting the relation, does the parent object ($object) need overwriting as well?
31
-            if ($relation->overwrite($object, $object->$name)) $this->parent[] = $object;
32
-        }
28
+	private function addRelationData($object, $name, $relation, $siblings) {
29
+		if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation) ) {
30
+			//After overwriting the relation, does the parent object ($object) need overwriting as well?
31
+			if ($relation->overwrite($object, $object->$name)) $this->parent[] = $object;
32
+		}
33 33
 
34
-        $object->$name = $relation->getData($object, $siblings);
35
-    }
34
+		$object->$name = $relation->getData($object, $siblings);
35
+	}
36 36
 }
Please login to merge, or discard this 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.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,14 +21,18 @@
 block discarded – undo
21 21
 
22 22
 	public function wrap($relations, $object, $siblings = []) {
23 23
 		//see if any relations need overwriting
24
-		foreach ($relations as $name => $relation) $this->addRelationData($object, $name, $relation, $siblings);
24
+		foreach ($relations as $name => $relation) {
25
+			$this->addRelationData($object, $name, $relation, $siblings);
26
+		}
25 27
 		return $object;
26 28
 	}
27 29
 
28 30
     private function addRelationData($object, $name, $relation, $siblings) {
29 31
         if (isset($object->$name) && !($object->$name instanceof \Maphper\Relation) ) {
30 32
             //After overwriting the relation, does the parent object ($object) need overwriting as well?
31
-            if ($relation->overwrite($object, $object->$name)) $this->parent[] = $object;
33
+            if ($relation->overwrite($object, $object->$name)) {
34
+            	$this->parent[] = $object;
35
+            }
32 36
         }
33 37
 
34 38
         $object->$name = $relation->getData($object, $siblings);
Please login to merge, or discard this patch.
Maphper/Lib/CrudBuilder.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 	public function delete($table, $criteria, $args, $limit = null, $offset = null, $order = null) {
9 9
 		$limit = $limit ? ' LIMIT ' . $limit : '';
10 10
 		$offset = $offset ? ' OFFSET ' . $offset : '';
11
-        $order = $order ? ' ORDER BY ' . $order : '';
11
+		$order = $order ? ' ORDER BY ' . $order : '';
12 12
 		return new Query('DELETE FROM ' . $table . ' WHERE ' . ($criteria ?: '1 = 1 ') . $order . $limit . $offset, $args);
13 13
 	}
14 14
 
Please login to merge, or discard this 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.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,10 +19,15 @@  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');
23
-				else $value = $value->format('Y-m-d H:i:s');
22
+				if ($value->format('H:i:s')  == '00:00:00') {
23
+					$value = $value->format('Y-m-d');
24
+				} else {
25
+					$value = $value->format('Y-m-d H:i:s');
26
+				}
27
+			}
28
+			if (is_object($value)) {
29
+				continue;
24 30
 			}
25
-			if (is_object($value)) continue;
26 31
 			if ($prependField){
27 32
 				$sql[] = $this->quote($field) . ' = :' . $field;
28 33
 			} else {
@@ -41,7 +46,9 @@  discard block
 block discarded – undo
41 46
 	public function update($table, array $primaryKey, $data) {
42 47
 		$query = $this->buildSaveQuery($data, true);
43 48
 		$where = [];
44
-		foreach($primaryKey as $field) $where[] = $this->quote($field) . ' = :' . $field;
49
+		foreach($primaryKey as $field) {
50
+			$where[] = $this->quote($field) . ' = :' . $field;
51
+		}
45 52
 		return new Query('UPDATE ' . $this->quote($table) . ' SET ' . implode(', ', $query['sql']). ' WHERE '. implode(' AND ', $where), $query['args']);
46 53
 	}
47 54
 }
Please login to merge, or discard this patch.
Maphper/Lib/ArrayFilter.php 3 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -3,58 +3,58 @@
 block discarded – undo
3 3
 use Maphper\Maphper;
4 4
 
5 5
 class ArrayFilter {
6
-    private $array;
7
-
8
-    public function __construct(array $array) {
9
-        $this->array = $array;
10
-    }
11
-
12
-    public function filter($fields) {
13
-        $filteredArray = array_filter($this->array, $this->getSearchFieldFunction($fields, \Maphper\Maphper::FIND_EXACT | \Maphper\Maphper::FIND_AND));
14
-        // Need to reset indexes
15
-        $filteredArray = array_values($filteredArray);
16
-        return $filteredArray;
17
-    }
18
-
19
-    private function getSearchFieldFunction($fields, $mode) {
20
-        return function ($data) use ($fields, $mode) {
21
-            foreach ($fields as $key => $val) {
22
-                $currentFieldResult = $this->getIfFieldMatches($key, $val, $data, $mode);
23
-
24
-                if (Maphper::FIND_OR & $mode && $currentFieldResult === true) return true;
25
-                else if (Maphper::FIND_OR ^ $mode && $currentFieldResult === false) return false;
26
-            }
27
-            return (bool)(Maphper::FIND_OR ^ $mode);
28
-        };
29
-    }
30
-
31
-    private function getIfFieldMatches($key, $val, $data, $mode) {
32
-        if ($this->shouldRunDeepSearch($key, $val)) {
33
-            return $this->getSearchFieldFunction($val, $key)($data);
34
-        }
35
-        else if (!isset($data->$key)) return false;
36
-        else if ($this->isInArraySearch($mode, $key, $val))
37
-            return in_array($data->$key, $val);
38
-        else
39
-            return $this->processFilter($mode, $val, $data->$key);
40
-    }
41
-
42
-    private function shouldRunDeepSearch($key, $val) {
43
-        return is_numeric($key) && is_array($val);
44
-    }
45
-
46
-    private function isInArraySearch($mode, $key, $val) {
47
-        return !(Maphper::FIND_BETWEEN & $mode) && !is_numeric($key) && is_array($val);
48
-    }
49
-
50
-    private function processFilter($mode, $expected, $actual) {
51
-        if (Maphper::FIND_NOT & $mode) return $expected != $actual;
52
-        else if ((Maphper::FIND_GREATER | Maphper::FIND_EXACT) === $mode) return $expected <= $actual;
53
-        else if ((Maphper::FIND_LESS | Maphper::FIND_EXACT) === $mode) return $expected >= $actual;
54
-        else if (Maphper::FIND_GREATER & $mode) return $expected < $actual;
55
-        else if (Maphper::FIND_LESS & $mode) return $expected > $actual;
56
-        else if (Maphper::FIND_BETWEEN & $mode) return $expected[0] <= $actual && $actual <= $expected[1];
57
-        else if (Maphper::FIND_NOCASE & $mode) return strtolower($expected) == strtolower($actual);
58
-        return $expected == $actual;
59
-    }
6
+	private $array;
7
+
8
+	public function __construct(array $array) {
9
+		$this->array = $array;
10
+	}
11
+
12
+	public function filter($fields) {
13
+		$filteredArray = array_filter($this->array, $this->getSearchFieldFunction($fields, \Maphper\Maphper::FIND_EXACT | \Maphper\Maphper::FIND_AND));
14
+		// Need to reset indexes
15
+		$filteredArray = array_values($filteredArray);
16
+		return $filteredArray;
17
+	}
18
+
19
+	private function getSearchFieldFunction($fields, $mode) {
20
+		return function ($data) use ($fields, $mode) {
21
+			foreach ($fields as $key => $val) {
22
+				$currentFieldResult = $this->getIfFieldMatches($key, $val, $data, $mode);
23
+
24
+				if (Maphper::FIND_OR & $mode && $currentFieldResult === true) return true;
25
+				else if (Maphper::FIND_OR ^ $mode && $currentFieldResult === false) return false;
26
+			}
27
+			return (bool)(Maphper::FIND_OR ^ $mode);
28
+		};
29
+	}
30
+
31
+	private function getIfFieldMatches($key, $val, $data, $mode) {
32
+		if ($this->shouldRunDeepSearch($key, $val)) {
33
+			return $this->getSearchFieldFunction($val, $key)($data);
34
+		}
35
+		else if (!isset($data->$key)) return false;
36
+		else if ($this->isInArraySearch($mode, $key, $val))
37
+			return in_array($data->$key, $val);
38
+		else
39
+			return $this->processFilter($mode, $val, $data->$key);
40
+	}
41
+
42
+	private function shouldRunDeepSearch($key, $val) {
43
+		return is_numeric($key) && is_array($val);
44
+	}
45
+
46
+	private function isInArraySearch($mode, $key, $val) {
47
+		return !(Maphper::FIND_BETWEEN & $mode) && !is_numeric($key) && is_array($val);
48
+	}
49
+
50
+	private function processFilter($mode, $expected, $actual) {
51
+		if (Maphper::FIND_NOT & $mode) return $expected != $actual;
52
+		else if ((Maphper::FIND_GREATER | Maphper::FIND_EXACT) === $mode) return $expected <= $actual;
53
+		else if ((Maphper::FIND_LESS | Maphper::FIND_EXACT) === $mode) return $expected >= $actual;
54
+		else if (Maphper::FIND_GREATER & $mode) return $expected < $actual;
55
+		else if (Maphper::FIND_LESS & $mode) return $expected > $actual;
56
+		else if (Maphper::FIND_BETWEEN & $mode) return $expected[0] <= $actual && $actual <= $expected[1];
57
+		else if (Maphper::FIND_NOCASE & $mode) return strtolower($expected) == strtolower($actual);
58
+		return $expected == $actual;
59
+	}
60 60
 }
Please login to merge, or discard this 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.
Braces   +26 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,8 +21,11 @@  discard block
 block discarded – undo
21 21
             foreach ($fields as $key => $val) {
22 22
                 $currentFieldResult = $this->getIfFieldMatches($key, $val, $data, $mode);
23 23
 
24
-                if (Maphper::FIND_OR & $mode && $currentFieldResult === true) return true;
25
-                else if (Maphper::FIND_OR ^ $mode && $currentFieldResult === false) return false;
24
+                if (Maphper::FIND_OR & $mode && $currentFieldResult === true) {
25
+                	return true;
26
+                } else if (Maphper::FIND_OR ^ $mode && $currentFieldResult === false) {
27
+                	return false;
28
+                }
26 29
             }
27 30
             return (bool)(Maphper::FIND_OR ^ $mode);
28 31
         };
@@ -31,12 +34,13 @@  discard block
 block discarded – undo
31 34
     private function getIfFieldMatches($key, $val, $data, $mode) {
32 35
         if ($this->shouldRunDeepSearch($key, $val)) {
33 36
             return $this->getSearchFieldFunction($val, $key)($data);
37
+        } else if (!isset($data->$key)) {
38
+        	return false;
39
+        } else if ($this->isInArraySearch($mode, $key, $val)) {
40
+                    return in_array($data->$key, $val);
41
+        } else {
42
+                    return $this->processFilter($mode, $val, $data->$key);
34 43
         }
35
-        else if (!isset($data->$key)) return false;
36
-        else if ($this->isInArraySearch($mode, $key, $val))
37
-            return in_array($data->$key, $val);
38
-        else
39
-            return $this->processFilter($mode, $val, $data->$key);
40 44
     }
41 45
 
42 46
     private function shouldRunDeepSearch($key, $val) {
@@ -48,13 +52,21 @@  discard block
 block discarded – undo
48 52
     }
49 53
 
50 54
     private function processFilter($mode, $expected, $actual) {
51
-        if (Maphper::FIND_NOT & $mode) return $expected != $actual;
52
-        else if ((Maphper::FIND_GREATER | Maphper::FIND_EXACT) === $mode) return $expected <= $actual;
53
-        else if ((Maphper::FIND_LESS | Maphper::FIND_EXACT) === $mode) return $expected >= $actual;
54
-        else if (Maphper::FIND_GREATER & $mode) return $expected < $actual;
55
-        else if (Maphper::FIND_LESS & $mode) return $expected > $actual;
56
-        else if (Maphper::FIND_BETWEEN & $mode) return $expected[0] <= $actual && $actual <= $expected[1];
57
-        else if (Maphper::FIND_NOCASE & $mode) return strtolower($expected) == strtolower($actual);
55
+        if (Maphper::FIND_NOT & $mode) {
56
+        	return $expected != $actual;
57
+        } else if ((Maphper::FIND_GREATER | Maphper::FIND_EXACT) === $mode) {
58
+        	return $expected <= $actual;
59
+        } else if ((Maphper::FIND_LESS | Maphper::FIND_EXACT) === $mode) {
60
+        	return $expected >= $actual;
61
+        } else if (Maphper::FIND_GREATER & $mode) {
62
+        	return $expected < $actual;
63
+        } else if (Maphper::FIND_LESS & $mode) {
64
+        	return $expected > $actual;
65
+        } else if (Maphper::FIND_BETWEEN & $mode) {
66
+        	return $expected[0] <= $actual && $actual <= $expected[1];
67
+        } else if (Maphper::FIND_NOCASE & $mode) {
68
+        	return strtolower($expected) == strtolower($actual);
69
+        }
58 70
         return $expected == $actual;
59 71
     }
60 72
 }
Please login to merge, or discard this patch.
Maphper/Lib/Sql/NullConditional.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 namespace Maphper\Lib\Sql;
3 3
 
4 4
 class NullConditional implements WhereConditional {
5
-    public function matches($key, $value, $mode) {
6
-        return $value === NULL;
7
-    }
5
+	public function matches($key, $value, $mode) {
6
+		return $value === NULL;
7
+	}
8 8
 
9
-    public function getSql($key, $value, $mode) {
10
-        $nullSql = $key . ' IS ';
11
-        if (\Maphper\Maphper::FIND_NOT & $mode) $nullSql .= 'NOT ';
12
-        $sql = [$nullSql . 'NULL'];
9
+	public function getSql($key, $value, $mode) {
10
+		$nullSql = $key . ' IS ';
11
+		if (\Maphper\Maphper::FIND_NOT & $mode) $nullSql .= 'NOT ';
12
+		$sql = [$nullSql . 'NULL'];
13 13
 
14
-        return ['args' => [], 'sql' => $sql];
15
-    }
14
+		return ['args' => [], 'sql' => $sql];
15
+	}
16 16
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
 
9 9
     public function getSql($key, $value, $mode) {
10 10
         $nullSql = $key . ' IS ';
11
-        if (\Maphper\Maphper::FIND_NOT & $mode) $nullSql .= 'NOT ';
11
+        if (\Maphper\Maphper::FIND_NOT & $mode) {
12
+        	$nullSql .= 'NOT ';
13
+        }
12 14
         $sql = [$nullSql . 'NULL'];
13 15
 
14 16
         return ['args' => [], 'sql' => $sql];
Please login to merge, or discard this patch.
Maphper/Lib/Sql/WhereConditional.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
2 2
 namespace Maphper\Lib\Sql;
3 3
 
4 4
 interface WhereConditional {
5
-    public function matches($key, $value, $mode);
6
-    public function getSql($key, $value, $mode);
5
+	public function matches($key, $value, $mode);
6
+	public function getSql($key, $value, $mode);
7 7
 }
Please login to merge, or discard this patch.
Maphper/Lib/Sql/Between.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -2,20 +2,20 @@
 block discarded – undo
2 2
 namespace Maphper\Lib\Sql;
3 3
 
4 4
 class Between implements WhereConditional {
5
-    public function matches($key, $value, $mode) {
6
-        return is_array($value) && \Maphper\Maphper::FIND_BETWEEN & $mode;
7
-    }
5
+	public function matches($key, $value, $mode) {
6
+		return is_array($value) && \Maphper\Maphper::FIND_BETWEEN & $mode;
7
+	}
8 8
 
9
-    public function getSql($key, $value, $mode) {
10
-        return [
11
-            'sql' => [
12
-                $key . '>= :' . $key . 'from',
13
-                $key . ' <= :' . $key . 'to'
14
-            ],
15
-            'args' => [
16
-                $key . 'from' => $value[0],
17
-                $key . 'to' => $value[1]
18
-            ]
19
-        ];
20
-    }
9
+	public function getSql($key, $value, $mode) {
10
+		return [
11
+			'sql' => [
12
+				$key . '>= :' . $key . 'from',
13
+				$key . ' <= :' . $key . 'to'
14
+			],
15
+			'args' => [
16
+				$key . 'from' => $value[0],
17
+				$key . 'to' => $value[1]
18
+			]
19
+		];
20
+	}
21 21
 }
Please login to merge, or discard this patch.