Passed
Push — master ( 4ada5b...453afa )
by Richard
02:12
created
Maphper/Lib/Sql/In.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,28 +2,28 @@
 block discarded – undo
2 2
 namespace Maphper\Lib\Sql;
3 3
 
4 4
 class In implements WhereConditional {
5
-    public function matches($key, $value, $mode) {
6
-        return !is_numeric($key) && is_array($value);
7
-    }
5
+	public function matches($key, $value, $mode) {
6
+		return !is_numeric($key) && is_array($value);
7
+	}
8 8
 
9
-    public function getSql($key, $value, $mode) {
10
-        $args = [];
11
-        $inSql = [];
12
-        $count = count($value);
13
-        $value = array_values($value); // fix numeric index being different than $i
14
-        for ($i = 0; $i < $count; $i++) {
15
-            $args[$key . $i] = $value[$i];
16
-            $inSql[] = ':' . $key . $i;
17
-        }
9
+	public function getSql($key, $value, $mode) {
10
+		$args = [];
11
+		$inSql = [];
12
+		$count = count($value);
13
+		$value = array_values($value); // fix numeric index being different than $i
14
+		for ($i = 0; $i < $count; $i++) {
15
+			$args[$key . $i] = $value[$i];
16
+			$inSql[] = ':' . $key . $i;
17
+		}
18 18
 
19
-        $notText = '';
20
-        if (\Maphper\Maphper::FIND_NOT & $mode) {
21
-            $notText = ' NOT';
22
-        }
19
+		$notText = '';
20
+		if (\Maphper\Maphper::FIND_NOT & $mode) {
21
+			$notText = ' NOT';
22
+		}
23 23
 
24
-        if (count($inSql) == 0) return ['args' => [], 'sql' => ''];
25
-        else $sql = [$key . $notText . ' IN ( ' .  implode(', ', $inSql) . ')'];
24
+		if (count($inSql) == 0) return ['args' => [], 'sql' => ''];
25
+		else $sql = [$key . $notText . ' IN ( ' .  implode(', ', $inSql) . ')'];
26 26
 
27
-        return ['args' => $args, 'sql' => $sql];
28
-    }
27
+		return ['args' => $args, 'sql' => $sql];
28
+	}
29 29
 }
Please login to merge, or discard this patch.
Maphper/Maphper.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -83,21 +83,21 @@  discard block
 block discarded – undo
83 83
 	}
84 84
 
85 85
 	public function offsetSet($offset, $valueObj) {
86
-        if ($valueObj instanceof \Maphper\Relation) throw new \Exception();
86
+		if ($valueObj instanceof \Maphper\Relation) throw new \Exception();
87 87
 
88
-        //Extract private properties from the object
89
-        $visibilityOverride = new \Maphper\Lib\VisibilityOverride($valueObj);
90
-        $value = $visibilityOverride->getProperties($valueObj);
88
+		//Extract private properties from the object
89
+		$visibilityOverride = new \Maphper\Lib\VisibilityOverride($valueObj);
90
+		$value = $visibilityOverride->getProperties($valueObj);
91 91
 
92
-        $value = $this->processFilters($value);
93
-        $pk = $this->dataSource->getPrimaryKey();
94
-        if ($offset !== null) $value->{$pk[0]} = $offset;
95
-        $valueCopy = $this->removeRelations(clone $value, $pk);
96
-        $value = $this->entity->wrap($this->relations, $value);
97
-        $this->dataSource->save($value);
98
-        $visibilityOverride->write($value);
99
-        $value = $this->entity->create((array_merge((array)$value, (array)$valueCopy)), $this->relations);
100
-        $visibilityOverride->write($value);
92
+		$value = $this->processFilters($value);
93
+		$pk = $this->dataSource->getPrimaryKey();
94
+		if ($offset !== null) $value->{$pk[0]} = $offset;
95
+		$valueCopy = $this->removeRelations(clone $value, $pk);
96
+		$value = $this->entity->wrap($this->relations, $value);
97
+		$this->dataSource->save($value);
98
+		$visibilityOverride->write($value);
99
+		$value = $this->entity->create((array_merge((array)$value, (array)$valueCopy)), $this->relations);
100
+		$visibilityOverride->write($value);
101 101
 	}
102 102
 
103 103
 	private function removeRelations($obj, $pk) { // Prevent saving ManyMany twice except when pk isn't initially set
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 
111 111
 	public function offsetExists($offset) {
112 112
 		if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey());
113
-        if (!empty($this->settings['filter'])) {
114
-            $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
115
-            return isset($data[0]);
116
-        }
113
+		if (!empty($this->settings['filter'])) {
114
+			$data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
115
+			return isset($data[0]);
116
+		}
117 117
 		return (bool) $this->dataSource->findById($offset);
118 118
 	}
119 119
 
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 
124 124
 	public function offsetGet($offset) {
125 125
 		if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey());
126
-        if (!empty($this->settings['filter'])) {
127
-            $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
128
-            return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations);
129
-        }
126
+		if (!empty($this->settings['filter'])) {
127
+			$data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
128
+			return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations);
129
+		}
130 130
 		return $this->entity->create($this->dataSource->findById($offset), $this->relations);
131 131
 	}
132 132
 
Please login to merge, or discard this patch.