Completed
Push — master ( 9cfab5...3e7612 )
by Ron
02:59
created
src/QueryLogger/QueryLoggers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 	 * @return $this
21 21
 	 */
22 22
 	public function log($query, $duration) {
23
-		foreach($this->queryLoggers as $queryLogger) {
23
+		foreach ($this->queryLoggers as $queryLogger) {
24 24
 			$queryLogger->log($query, $duration);
25 25
 		}
26 26
 		return $this;
Please login to merge, or discard this patch.
src/Tools/AliasReplacer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@
 block discarded – undo
19 19
 	 * @return string
20 20
 	 */
21 21
 	public function replace($name) {
22
-		$fn = function ($values) {
22
+		$fn = function($values) {
23 23
 			$alias = $values[1];
24 24
 			$part = $values[2];
25 25
 			$string = $this->aliasRegistry->get($alias);
26
-			return $string . $part;
26
+			return $string.$part;
27 27
 		};
28 28
 		return preg_replace_callback('/^(\\w+)#(\\w+)$/', $fn, $name);
29 29
 	}
Please login to merge, or discard this patch.
src/Tools/AliasRegistry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 * @return string
24 24
 	 */
25 25
 	public function get($alias) {
26
-		if(!array_key_exists($alias, $this->aliases)) {
26
+		if (!array_key_exists($alias, $this->aliases)) {
27 27
 			throw new \Exception("Alias not found: {$alias}");
28 28
 		}
29 29
 		return $this->aliases[$alias];
Please login to merge, or discard this patch.
src/Builder/Select.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -37,17 +37,17 @@  discard block
 block discarded – undo
37 37
 	 * @return $this
38 38
 	 */
39 39
 	public function field($expression, $alias = null) {
40
-		if(is_object($expression)) {
40
+		if (is_object($expression)) {
41 41
 			$expression = (string) $expression;
42 42
 			$expression = trim($expression);
43 43
 			$expression = rtrim($expression, ';');
44 44
 			$expression = trim($expression);
45 45
 			$lines = explode("\n", $expression);
46
-			$lines = array_map(function ($line) { return "\t\t{$line}"; }, $lines);
46
+			$lines = array_map(function($line) { return "\t\t{$line}"; }, $lines);
47 47
 			$expression = join("\n", $lines);
48 48
 			$expression = sprintf("(\n%s\n\t)", $expression);
49 49
 		}
50
-		if($alias === null) {
50
+		if ($alias === null) {
51 51
 			$this->fields[] = $expression;
52 52
 		} else {
53 53
 			$this->fields[$alias] = $expression;
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @return $this
61 61
 	 */
62 62
 	public function fields(array $fields) {
63
-		foreach($fields as $alias => $expression) {
63
+		foreach ($fields as $alias => $expression) {
64 64
 			$this->field($expression, $alias);
65 65
 		}
66 66
 		return $this;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @return $this
96 96
 	 */
97 97
 	public function setCalcFoundRows($calcFoundRows = true) {
98
-		if(ini_get("mysql.trace_mode")) {
98
+		if (ini_get("mysql.trace_mode")) {
99 99
 			throw new \Exception('This function cant operate with mysql.trace_mode is set.');
100 100
 		}
101 101
 		$this->calcFoundRows = $calcFoundRows;
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function __toString() {
119 119
 		$query = "SELECT";
120
-		if($this->calcFoundRows) {
120
+		if ($this->calcFoundRows) {
121 121
 			$query .= " SQL_CALC_FOUND_ROWS";
122 122
 		}
123 123
 		$query .= "\n";
124 124
 		$query = $this->buildFields($query);
125
-		if(count($this->getTables())) {
125
+		if (count($this->getTables())) {
126 126
 			$query .= "FROM\n";
127 127
 		}
128 128
 		$query = $this->buildTables($query);
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	private function buildFields($query) {
146 146
 		$fields = array();
147
-		if(count($this->fields)) {
148
-			foreach($this->fields as $alias => $expression) {
149
-				if(is_numeric($alias)) {
147
+		if (count($this->fields)) {
148
+			foreach ($this->fields as $alias => $expression) {
149
+				if (is_numeric($alias)) {
150 150
 					$fields[] = "\t{$expression}";
151 151
 				} else {
152 152
 					$fields[] = "\t{$expression} AS `{$alias}`";
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @return string
164 164
 	 */
165 165
 	private function buildForUpdate($query) {
166
-		if($this->forUpdate) {
166
+		if ($this->forUpdate) {
167 167
 			$query .= "FOR UPDATE\n";
168 168
 		}
169 169
 		return $query;
Please login to merge, or discard this patch.
src/Builder/QueryStatement.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 * @return bool
44 44
 	 */
45 45
 	public function execute(array $params = []) {
46
-		return $this->exceptionHandler(function () use ($params) {
46
+		return $this->exceptionHandler(function() use ($params) {
47 47
 			$timer = microtime(true);
48 48
 			$response = $this->statement->execute($params);
49
-			$this->queryLoggers->log($this->query, microtime(true) - $timer);
49
+			$this->queryLoggers->log($this->query, microtime(true)-$timer);
50 50
 			return $response;
51 51
 		});
52 52
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 */
57 57
 	public function fetchAll() {
58 58
 		$args = func_get_args();
59
-		return $this->exceptionHandler(function () use ($args) {
59
+		return $this->exceptionHandler(function() use ($args) {
60 60
 			return call_user_func_array([$this->statement, 'fetchAll'], $args);
61 61
 		});
62 62
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @return mixed
69 69
 	 */
70 70
 	public function fetch($fetchStyle = PDO::FETCH_ASSOC, $cursorOrientation = PDO::FETCH_ORI_NEXT, $cursorOffset = 0) {
71
-		return $this->exceptionHandler(function () use ($fetchStyle, $cursorOrientation, $cursorOffset) {
71
+		return $this->exceptionHandler(function() use ($fetchStyle, $cursorOrientation, $cursorOffset) {
72 72
 			return $this->statement->fetch($fetchStyle, $cursorOrientation, $cursorOffset);
73 73
 		});
74 74
 	}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @return mixed
79 79
 	 */
80 80
 	public function fetchColumn($columnNo = 0) {
81
-		return $this->exceptionHandler(function () use ($columnNo) {
81
+		return $this->exceptionHandler(function() use ($columnNo) {
82 82
 			return $this->statement->fetchColumn($columnNo);
83 83
 		});
84 84
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return bool
88 88
 	 */
89 89
 	public function closeCursor() {
90
-		return $this->exceptionHandler(function () {
90
+		return $this->exceptionHandler(function() {
91 91
 			return $this->statement->closeCursor();
92 92
 		});
93 93
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	 * @return int
97 97
 	 */
98 98
 	public function columnCount() {
99
-		return $this->exceptionHandler(function () {
99
+		return $this->exceptionHandler(function() {
100 100
 			return $this->statement->columnCount();
101 101
 		});
102 102
 	}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 * @return array
107 107
 	 */
108 108
 	public function getColumnMeta($columnNo) {
109
-		return $this->exceptionHandler(function () use ($columnNo) {
109
+		return $this->exceptionHandler(function() use ($columnNo) {
110 110
 			return $this->statement->getColumnMeta($columnNo);
111 111
 		});
112 112
 	}
Please login to merge, or discard this patch.
src/Builder/Statement.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@
 block discarded – undo
24 24
 	 * @return $this
25 25
 	 */
26 26
 	public function debug($stop = true) {
27
-		if(php_sapi_name() == 'cli') {
27
+		if (php_sapi_name() == 'cli') {
28 28
 			echo "\n{$this->__toString()}\n";
29 29
 		} else {
30 30
 			echo "<pre>{$this->__toString()}</pre>";
31 31
 		}
32
-		if($stop) {
32
+		if ($stop) {
33 33
 			exit;
34 34
 		}
35 35
 		return $this;
Please login to merge, or discard this patch.
src/Builder/Update.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
 	 * @throws Exception
75 75
 	 */
76 76
 	public function setAll(array $data, array $allowedFields = null) {
77
-		if($allowedFields !== null) {
78
-			foreach($data as $fieldName => $value) {
79
-				if(in_array($fieldName, $allowedFields)) {
77
+		if ($allowedFields !== null) {
78
+			foreach ($data as $fieldName => $value) {
79
+				if (in_array($fieldName, $allowedFields)) {
80 80
 					$this->set($fieldName, $value);
81 81
 				}
82 82
 			}
83 83
 		} else {
84 84
 			$values = $this->clearValues($data);
85
-			foreach($values as $fieldName => $value) {
85
+			foreach ($values as $fieldName => $value) {
86 86
 				$this->set($fieldName, $value);
87 87
 			}
88 88
 		}
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
 	 * @throws Exception
126 126
 	 */
127 127
 	private function clearValues(array $values) {
128
-		if(!count($values)) {
128
+		if (!count($values)) {
129 129
 			return [];
130 130
 		}
131 131
 		$tables = $this->getTables();
132
-		if(!count($tables)) {
132
+		if (!count($tables)) {
133 133
 			throw new Exception('Table name is missing');
134 134
 		}
135
-		if(count($tables) > 1) {
135
+		if (count($tables) > 1) {
136 136
 			throw new Exception('Batch values only work with max. one table');
137 137
 		}
138 138
 		list($table) = $tables;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		$result = array();
143 143
 
144 144
 		foreach ($values as $fieldName => $fieldValue) {
145
-			if(in_array($fieldName, $fields)) {
145
+			if (in_array($fieldName, $fields)) {
146 146
 				$result[$fieldName] = $fieldValue;
147 147
 			}
148 148
 		}
Please login to merge, or discard this patch.
src/Builder/InsertUpdateStatement.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	protected function buildFieldList(array $fields, array $query = array()) {
32 32
 		foreach ($fields as $fieldName => $fieldValue) {
33
-			if($fieldValue instanceof DefaultValue) {
33
+			if ($fieldValue instanceof DefaultValue) {
34 34
 				$fieldValue = 'DEFAULT';
35 35
 			}
36
-			if(is_array($this->mask) && !in_array($fieldName, $this->mask)) {
36
+			if (is_array($this->mask) && !in_array($fieldName, $this->mask)) {
37 37
 				continue;
38 38
 			}
39 39
 			if (is_int($fieldName)) {
40
-				if(is_array($fieldValue)) {
40
+				if (is_array($fieldValue)) {
41 41
 					$fieldValue = $this->db()->quoteExpression($fieldValue[0], array_slice($fieldValue, 1));
42 42
 				}
43 43
 				$query[] = "\t{$fieldValue}";
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 * @return bool
56 56
 	 */
57 57
 	protected function isFieldAccessible($fieldName, array $tableFields) {
58
-		if(!in_array($fieldName, $tableFields)) {
58
+		if (!in_array($fieldName, $tableFields)) {
59 59
 			return false;
60 60
 		}
61
-		if(!is_array($this->mask)) {
61
+		if (!is_array($this->mask)) {
62 62
 			return true;
63 63
 		}
64 64
 		return in_array($fieldName, $this->mask);
Please login to merge, or discard this patch.
src/Builder/RunnableInsert.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@  discard block
 block discarded – undo
15 15
 	 * @return int[] Insert IDs
16 16
 	 */
17 17
 	public function insertRows($rows) {
18
-		if(!(is_array($rows) || $rows instanceof Traversable)) {
18
+		if (!(is_array($rows) || $rows instanceof Traversable)) {
19 19
 			throw new BadMethodCallException('Expected $rows to by an array or an instance of \\Traversable');
20 20
 		}
21 21
 		$result = [];
22 22
 		$query = $this->__toString();
23 23
 		$stmt = $this->db()->prepare($query);
24
-		foreach($rows as $row) {
24
+		foreach ($rows as $row) {
25 25
 			$stmt->execute($row);
26 26
 			$result[] = (int) $this->db()->getLastInsertId();
27 27
 		}
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @return DDLRunnable
34 34
 	 */
35 35
 	public function prepare() {
36
-		return $this->createPreparable($this->db()->prepare($this), function () {
36
+		return $this->createPreparable($this->db()->prepare($this), function() {
37 37
 			return (int) $this->db()->getLastInsertId();
38 38
 		});
39 39
 	}
Please login to merge, or discard this patch.