Passed
Push — master ( 02cf1a...e288dc )
by Richard
01:43
created
maphper/relation/one.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
74 74
 
75 75
 	public function __get($name) {
76 76
 		if ($this->lazyLoad()) return $this->lazyLoad()->$name;
77
-        else return null;
77
+		else return null;
78 78
 	}
79 79
 
80 80
 	public function __isset($name) {
Please login to merge, or discard this patch.
maphper/relation/manymanyiterator.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@
 block discarded – undo
7 7
   private $intermediateName;
8 8
 
9 9
   public function __construct(\Maphper\Iterator $iterator, $intermediateName = null) {
10
-    $this->iterator = $iterator;
11
-    $this->intermediateName = $intermediateName;
10
+	$this->iterator = $iterator;
11
+	$this->intermediateName = $intermediateName;
12 12
   }
13 13
 
14 14
   public function current() {
15
-    if ($this->intermediateName) return $this->iterator->current()->{$this->intermediateName};
15
+	if ($this->intermediateName) return $this->iterator->current()->{$this->intermediateName};
16 16
 		return $this->iterator->current();
17 17
 	}
18 18
 
19 19
 	public function key() {
20
-    return $this->iterator->key();
20
+	return $this->iterator->key();
21 21
 	}
22 22
 
23 23
 	public function next() {
Please login to merge, or discard this patch.
maphper/maphper.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -96,15 +96,15 @@  discard block
 block discarded – undo
96 96
 		$value = $this->entity->wrap($this->relations, $value);
97 97
 		$this->dataSource->save($value);
98 98
 		$visibilityOverride->write($value);
99
-        $this->entity->create((array_merge((array)$value, (array)$valueCopy)), $this->relations);
99
+		$this->entity->create((array_merge((array)$value, (array)$valueCopy)), $this->relations);
100 100
 	}
101 101
 
102 102
 	public function offsetExists($offset) {
103 103
 		if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey());
104
-        if (!empty($this->settings['filter'])) {
105
-            $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
106
-            return isset($data[0]);
107
-        }
104
+		if (!empty($this->settings['filter'])) {
105
+			$data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
106
+			return isset($data[0]);
107
+		}
108 108
 		return (bool) $this->dataSource->findById($offset);
109 109
 	}
110 110
 
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
 
115 115
 	public function offsetGet($offset) {
116 116
 		if (count($this->dataSource->getPrimaryKey()) > 1) return new MultiPk($this, $offset, $this->dataSource->getPrimaryKey());
117
-        if (!empty($this->settings['filter'])) {
118
-            $data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
119
-            return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations);
120
-        }
117
+		if (!empty($this->settings['filter'])) {
118
+			$data = $this->dataSource->findByField(array_merge($this->settings['filter'], [$this->dataSource->getPrimaryKey()[0] => $offset]));
119
+			return $this->entity->create(isset($data[0]) ? $data[0] : null, $this->relations);
120
+		}
121 121
 		return $this->entity->create($this->dataSource->findById($offset), $this->relations);
122 122
 	}
123 123
 
Please login to merge, or discard this patch.
maphper/multipk.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 	private $parent;
5 5
 	private $primaryKey;
6 6
 	private $lookup;
7
-    private $mapper;
7
+	private $mapper;
8 8
 
9 9
 	public function __construct(Maphper $mapper, $lookup, array $primaryKey, MultiPk $parent = null) {
10 10
 		$this->parent = $parent;
Please login to merge, or discard this patch.
maphper/lib/crudbuilder.php 1 patch
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.
maphper/datasource/mysqladapter.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		$this->pdo = $pdo;
9 9
 		//Set to strict mode to detect 'out of range' errors, action at a distance but it needs to be set for all INSERT queries
10 10
 		$this->pdo->query('SET sql_mode = STRICT_ALL_TABLES');
11
-        $this->stmtCache = new StmtCache($pdo);
11
+		$this->stmtCache = new StmtCache($pdo);
12 12
 	}
13 13
 
14 14
 	public function quote($str) {
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	public function query(\Maphper\Lib\Query $query) {
19 19
 		$stmt = $this->stmtCache->getCachedStmt($query->getSql());
20 20
 		$args = $query->getArgs();
21
-        $stmt->execute($args);
21
+		$stmt->execute($args);
22 22
 
23 23
 		return $stmt;
24 24
 	}
Please login to merge, or discard this patch.
maphper/datasource/sqliteadapter.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 	public function __construct(\PDO $pdo) {
9 9
 		$this->pdo = $pdo;
10
-        $this->stmtCache = new StmtCache($pdo);
10
+		$this->stmtCache = new StmtCache($pdo);
11 11
 	}
12 12
 
13 13
 	public function quote($str) {
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
 	}
16 16
 
17 17
 	public function query(\Maphper\Lib\Query $query) {
18
-        $stmt = $this->stmtCache->getCachedStmt($query->getSql());
18
+		$stmt = $this->stmtCache->getCachedStmt($query->getSql());
19 19
 		$args = $query->getArgs();
20 20
 
21
-        //Handle SQLite when PDO_ERRMODE is set to SILENT
22
-        if ($stmt === false) throw new \Exception('Invalid query');
21
+		//Handle SQLite when PDO_ERRMODE is set to SILENT
22
+		if ($stmt === false) throw new \Exception('Invalid query');
23 23
 
24
-        $stmt->execute($args);
25
-        if ($stmt->errorCode() !== '00000' && $stmt->errorInfo()[2] == 'database schema has changed') {
24
+		$stmt->execute($args);
25
+		if ($stmt->errorCode() !== '00000' && $stmt->errorInfo()[2] == 'database schema has changed') {
26 26
 			$this->stmtCache->deleteQueryFromCache($query->getSql());
27 27
 			return $this->query($query);
28
-        }
28
+		}
29 29
 
30
-        return $stmt;
30
+		return $stmt;
31 31
 	}
32 32
 	
33 33
 	public function lastInsertId() {
Please login to merge, or discard this patch.
maphper/datasource/StmtCache.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Maphper\DataSource;
3 3
 class StmtCache {
4
-    private $pdo;
5
-    private $queryCache = [];
4
+	private $pdo;
5
+	private $queryCache = [];
6 6
 
7
-    public function __construct(\PDO $pdo) {
8
-        $this->pdo = $pdo;
9
-    }
7
+	public function __construct(\PDO $pdo) {
8
+		$this->pdo = $pdo;
9
+	}
10 10
 
11
-    public function getCachedStmt($sql) {
11
+	public function getCachedStmt($sql) {
12 12
 		$queryId = $this->getQueryId($sql);
13 13
 		if (isset($this->queryCache[$queryId])) $stmt = $this->queryCache[$queryId];
14 14
 		else {
@@ -18,15 +18,15 @@  discard block
 block discarded – undo
18 18
 		return $stmt;
19 19
 	}
20 20
 
21
-    private function getQueryId($sql) {
22
-        return md5($sql);
23
-    }
21
+	private function getQueryId($sql) {
22
+		return md5($sql);
23
+	}
24 24
 
25
-    public function deleteQueryFromCache($sql) {
26
-        unset($this->queryCache[$this->getQueryId($sql)]);
27
-    }
25
+	public function deleteQueryFromCache($sql) {
26
+		unset($this->queryCache[$this->getQueryId($sql)]);
27
+	}
28 28
 
29
-    public function clearCache() {
30
-        $this->queryCache = [];
31
-    }
29
+	public function clearCache() {
30
+		$this->queryCache = [];
31
+	}
32 32
 }
Please login to merge, or discard this patch.
maphper/lib/Sql/WhereBuilder.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -2,18 +2,18 @@  discard block
 block discarded – undo
2 2
 namespace Maphper\Lib\Sql;
3 3
 
4 4
 class WhereBuilder {
5
-    //Needs to be broken up into better methods
5
+	//Needs to be broken up into better methods
6 6
 	public function createSql($fields, $mode = \Maphper\Maphper::FIND_EXACT | \Maphper\Maphper::FIND_AND){
7 7
 		$args = [];
8 8
 		$sql = [];
9 9
 
10 10
 		foreach ($fields as $key => $value) {
11
-            if ($value instanceof \DateTime) {
12
-    			if ($value->format('H:i:s')  == '00:00:00') $value = $value->format('Y-m-d');
13
-    			else $value = $value->format('Y-m-d H:i:s');
14
-    		}
11
+			if ($value instanceof \DateTime) {
12
+				if ($value->format('H:i:s')  == '00:00:00') $value = $value->format('Y-m-d');
13
+				else $value = $value->format('Y-m-d H:i:s');
14
+			}
15 15
 
16
-            if (is_object($value)) continue;
16
+			if (is_object($value)) continue;
17 17
 			if (is_numeric($key) && is_array($value)) {
18 18
 				$result = $this->createSql($value, $key);
19 19
 				foreach ($result['args'] as $arg_key => $arg) $args[$arg_key] = $arg;
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
 		return ['args' => $args, 'sql' => $query];
65 65
 	}
66 66
 
67
-    private function getOperator($mode) {
68
-        $operator = "";
67
+	private function getOperator($mode) {
68
+		$operator = "";
69 69
 
70
-        if (\Maphper\Maphper::FIND_NOCASE & $mode) $operator = 'LIKE';
71
-        else if (\Maphper\Maphper::FIND_BIT & $mode) $operator = '&';
72
-        else if (\Maphper\Maphper::FIND_GREATER & $mode) $operator = '>';
73
-        else if (\Maphper\Maphper::FIND_LESS & $mode) $operator = '<';
74
-        else if (\Maphper\Maphper::FIND_NOT & $mode) $operator = '!=';
70
+		if (\Maphper\Maphper::FIND_NOCASE & $mode) $operator = 'LIKE';
71
+		else if (\Maphper\Maphper::FIND_BIT & $mode) $operator = '&';
72
+		else if (\Maphper\Maphper::FIND_GREATER & $mode) $operator = '>';
73
+		else if (\Maphper\Maphper::FIND_LESS & $mode) $operator = '<';
74
+		else if (\Maphper\Maphper::FIND_NOT & $mode) $operator = '!=';
75 75
 
76
-        if (\Maphper\Maphper::FIND_EXACT & $mode) $operator .= '=';
76
+		if (\Maphper\Maphper::FIND_EXACT & $mode) $operator .= '=';
77 77
 
78
-        return $operator;
79
-    }
78
+		return $operator;
79
+	}
80 80
 }
Please login to merge, or discard this patch.