Completed
Push — master ( e2093b...574567 )
by Ron
02:27
created
src/DiffStorage.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	private function buildSchema($schema) {
84 84
 		$def = [];
85
-		foreach($schema as $name => $type) {
85
+		foreach ($schema as $name => $type) {
86 86
 			switch ($type) {
87 87
 				case 'BOOL':
88 88
 					$def[] = sprintf('CASE WHEN CAST(:'.$name.' AS INT) = 0 THEN \'false\' ELSE \'true\' END');
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 					break;
108 108
 			}
109 109
 		}
110
-		if(!count($def)) {
110
+		if (!count($def)) {
111 111
 			throw new EmptySchemaException('Can\'t operate with empty schema');
112 112
 		}
113 113
 		return join('||"|"||', $def);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	private function buildConverter($schema) {
122 122
 		$def = [];
123
-		foreach($schema as $name => $type) {
123
+		foreach ($schema as $name => $type) {
124 124
 			switch ($type) {
125 125
 				case 'BOOL':
126 126
 					$def[$name] = 'boolval';
@@ -129,19 +129,19 @@  discard block
 block discarded – undo
129 129
 					$def[$name] = 'intval';
130 130
 					break;
131 131
 				case 'FLOAT':
132
-					$def[$name] = function ($value) { return number_format((float) $value, 6, '.', ''); };
132
+					$def[$name] = function($value) { return number_format((float) $value, 6, '.', ''); };
133 133
 					break;
134 134
 				case 'DOUBLE':
135
-					$def[$name] = function ($value) { return number_format((float) $value, 12, '.', ''); };
135
+					$def[$name] = function($value) { return number_format((float) $value, 12, '.', ''); };
136 136
 					break;
137 137
 				case 'MONEY':
138
-					$def[$name] = function ($value) { return number_format((float) $value, 2, '.', ''); };
138
+					$def[$name] = function($value) { return number_format((float) $value, 2, '.', ''); };
139 139
 					break;
140 140
 				case 'STRING':
141
-					$def[$name] = function ($value) { return (string) $value; };
141
+					$def[$name] = function($value) { return (string) $value; };
142 142
 					break;
143 143
 				case 'MD5':
144
-					$def[$name] = function ($value) { return md5((string) $value); };
144
+					$def[$name] = function($value) { return md5((string) $value); };
145 145
 					break;
146 146
 			}
147 147
 		}
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 	/**
152 152
 	 */
153 153
 	private function compatibility() {
154
-		if(!$this->testStatement('SELECT printf("%0.2f", 19.99999) AS res')) {
154
+		if (!$this->testStatement('SELECT printf("%0.2f", 19.99999) AS res')) {
155 155
 			$this->registerUDFunction('printf', 'sprintf');
156 156
 		}
157 157
 
158
-		if(!$this->testStatement('SELECT md5("aaa") AS md5res')) {
158
+		if (!$this->testStatement('SELECT md5("aaa") AS md5res')) {
159 159
 			$this->registerUDFunction('md5', 'md5');
160 160
 		}
161 161
 	}
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @throws Exception
179 179
 	 */
180 180
 	private function registerUDFunction($name, $callback) {
181
-		if(!method_exists($this->pdo, 'sqliteCreateFunction')) {
181
+		if (!method_exists($this->pdo, 'sqliteCreateFunction')) {
182 182
 			throw new Exception('It is not possible to create user defined functions for rkr/data-diff\'s sqlite instance');
183 183
 		}
184 184
 		call_user_func([$this->pdo, 'sqliteCreateFunction'], $name, $callback);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	/**
188 188
 	 */
189 189
 	private function initSqlite() {
190
-		$tryThis = function ($query) {
190
+		$tryThis = function($query) {
191 191
 			try {
192 192
 				$this->pdo->exec($query);
193 193
 			} catch (Exception $e) {
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	 * @return array
214 214
 	 */
215 215
 	private function defineOptionDefaults($options) {
216
-		if(!array_key_exists('dsn', $options)) {
216
+		if (!array_key_exists('dsn', $options)) {
217 217
 			$options['dsn'] = 'sqlite::memory:';
218 218
 		}
219
-		if(!array_key_exists('duplicate_key_handler', $options)) {
220
-			$options['duplicate_key_handler'] = function (array $newData = null, array $oldData = null) {
219
+		if (!array_key_exists('duplicate_key_handler', $options)) {
220
+			$options['duplicate_key_handler'] = function(array $newData = null, array $oldData = null) {
221 221
 				return array_merge($oldData, $newData);
222 222
 			};
223 223
 		}
Please login to merge, or discard this patch.