Passed
Branch master (73cfe8)
by Ondřej
06:41
created
src/Ivory/Connection/ConnConfigValueRetriever.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@
 block discarded – undo
46 46
         if ($this->observingConfig) {
47 47
             $this->cachedValue = $value;
48 48
             $this->isCached = true;
49
-        }
50
-        else {
49
+        } else {
51 50
             if (!$this->warnedOnPerformancePenalty) {
52 51
                 trigger_error(
53 52
                     sprintf('Performance penalty: must retrieve the "%s" config value for every single item. Use an %s',
Please login to merge, or discard this patch.
src/Ivory/NamedDbObject.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -3,32 +3,32 @@
 block discarded – undo
3 3
 
4 4
 trait NamedDbObject
5 5
 {
6
-	private $schemaName;
7
-	private $name;
6
+    private $schemaName;
7
+    private $name;
8 8
 
9
-	/**
10
-	 * @param string $schemaName
11
-	 * @param string $name
12
-	 */
13
-	protected function setName($schemaName, $name)
14
-	{
15
-		$this->schemaName = $schemaName;
16
-		$this->name = $name;
17
-	}
9
+    /**
10
+     * @param string $schemaName
11
+     * @param string $name
12
+     */
13
+    protected function setName($schemaName, $name)
14
+    {
15
+        $this->schemaName = $schemaName;
16
+        $this->name = $name;
17
+    }
18 18
 
19
-	/**
20
-	 * @return string name of schema this object is defined in
21
-	 */
22
-	final public function getSchemaName()
23
-	{
24
-		return $this->schemaName;
25
-	}
19
+    /**
20
+     * @return string name of schema this object is defined in
21
+     */
22
+    final public function getSchemaName()
23
+    {
24
+        return $this->schemaName;
25
+    }
26 26
 
27
-	/**
28
-	 * @return string name of this object
29
-	 */
30
-	final public function getName()
31
-	{
32
-		return $this->name;
33
-	}
27
+    /**
28
+     * @return string name of this object
29
+     */
30
+    final public function getName()
31
+    {
32
+        return $this->name;
33
+    }
34 34
 }
Please login to merge, or discard this patch.
src/Ivory/Utils/ComparableWithPhpOperators.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
     {
11 11
         if ($object === null) {
12 12
             return null;
13
-        }
14
-        else {
13
+        } else {
15 14
             return ($this == $object);
16 15
         }
17 16
     }
Please login to merge, or discard this patch.
src/Ivory/Utils/Singleton.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,36 +6,36 @@
 block discarded – undo
6 6
  */
7 7
 trait Singleton
8 8
 {
9
-	final private function __construct()
10
-	{
11
-		static::initializeSingleton();
12
-	}
9
+    final private function __construct()
10
+    {
11
+        static::initializeSingleton();
12
+    }
13 13
 
14
-	/**
15
-	 * Initialization method of the singleton - gets called upon the singleton instance construction.
16
-	 *
17
-	 * To be overridden by classes which need to initialize.
18
-	 */
19
-	protected function initializeSingleton() {}
14
+    /**
15
+     * Initialization method of the singleton - gets called upon the singleton instance construction.
16
+     *
17
+     * To be overridden by classes which need to initialize.
18
+     */
19
+    protected function initializeSingleton() {}
20 20
 
21
-	/**
22
-	 * Creates the singleton instance, if it has not been created yet, and returns it.
23
-	 *
24
-	 * After creating the instance, {@link initializeSingleton()} is called to perform custom initialization.
25
-	 *
26
-	 * @return static the singleton instance
27
-	 */
28
-	final public static function getInstance()
29
-	{
30
-		static $instances = array();
31
-		$class = get_called_class();
32
-		if (!isset($instances[$class])) {
33
-			$instances[$class] = new static();
34
-		}
35
-		return $instances[$class];
36
-	}
21
+    /**
22
+     * Creates the singleton instance, if it has not been created yet, and returns it.
23
+     *
24
+     * After creating the instance, {@link initializeSingleton()} is called to perform custom initialization.
25
+     *
26
+     * @return static the singleton instance
27
+     */
28
+    final public static function getInstance()
29
+    {
30
+        static $instances = array();
31
+        $class = get_called_class();
32
+        if (!isset($instances[$class])) {
33
+            $instances[$class] = new static();
34
+        }
35
+        return $instances[$class];
36
+    }
37 37
 
38
-	final private function __clone() {}
38
+    final private function __clone() {}
39 39
 
40
-	final private function __wakeup() {}
40
+    final private function __wakeup() {}
41 41
 }
Please login to merge, or discard this patch.
src/Ivory/Utils/ValueUtils.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
         if ($a instanceof IComparable) {
13 13
             return $a->equals($b);
14
-        }
15
-        elseif (is_array($a)) {
14
+        } elseif (is_array($a)) {
16 15
             if (!is_array($b)) {
17 16
                 return false;
18 17
             }
@@ -28,8 +27,7 @@  discard block
 block discarded – undo
28 27
                 }
29 28
             }
30 29
             return true;
31
-        }
32
-        else {
30
+        } else {
33 31
             return ($a == $b);
34 32
         }
35 33
     }
Please login to merge, or discard this patch.
src/Ivory/INamedDbObject.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
  */
7 7
 interface INamedDbObject
8 8
 {
9
-	/**
10
-	 * @return string name of this object
11
-	 */
12
-	function getName();
9
+    /**
10
+     * @return string name of this object
11
+     */
12
+    function getName();
13 13
 
14
-	/**
15
-	 * @return string name of schema this object is defined in
16
-	 */
17
-	function getSchemaName();
14
+    /**
15
+     * @return string name of schema this object is defined in
16
+     */
17
+    function getSchemaName();
18 18
 }
Please login to merge, or discard this patch.
src/Ivory/Query/SqlRecipe.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
             $curFragmentNum++;
275 275
             $argsProcessed += count($posParams);
276 276
 
277
-            $curFragment =& $fragmentsAndPositionalParams[$argsProcessed];
277
+            $curFragment = & $fragmentsAndPositionalParams[$argsProcessed];
278 278
             $argsProcessed++;
279 279
         } while (isset($curFragment));
280 280
 
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             else {
360 360
                 $msg = sprintf(
361 361
                     'Values for parameters %s and "%s" have not been set.',
362
-                    array_map(function ($s) { return "\"$s\""; }, array_slice($names, 0, -1))
362
+                    array_map(function($s) { return "\"$s\""; }, array_slice($names, 0, -1))
363 363
                 );
364 364
             }
365 365
             throw new InvalidStateException($msg);
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -218,8 +218,7 @@  discard block
 block discarded – undo
218 218
                 if (is_string($curFragment)) {
219 219
                     $parser = \Ivory\Ivory::getSqlPatternParser();
220 220
                     $curFragment = $parser->parse($curFragment);
221
-                }
222
-                else {
221
+                } else {
223 222
                     $ord = StringUtils::englishOrd($curFragmentNum);
224 223
                     throw new \InvalidArgumentException("Invalid type of $ord fragment. Isn't it a misplaced parameter value?");
225 224
                 }
@@ -265,8 +264,7 @@  discard block
 block discarded – undo
265 264
             $posParams = array_slice($fragmentsAndPositionalParams, $argsProcessed, $plcHdrCnt);
266 265
             if (count($posParams) == $plcHdrCnt) {
267 266
                 $overallPosParams = array_merge($overallPosParams, $posParams);
268
-            }
269
-            else {
267
+            } else {
270 268
                 $ord = StringUtils::englishOrd($curFragmentNum);
271 269
                 throw new \InvalidArgumentException("Not enough positional parameters for the $ord fragment");
272 270
             }
@@ -307,8 +305,7 @@  discard block
 block discarded – undo
307 305
     {
308 306
         if (isset($this->unsatisfiedParams[$nameOrPosition])) {
309 307
             unset($this->unsatisfiedParams[$nameOrPosition]);
310
-        }
311
-        elseif (!array_key_exists($nameOrPosition, $this->params)) {
308
+        } elseif (!array_key_exists($nameOrPosition, $this->params)) {
312 309
             throw new \InvalidArgumentException("The SQL pattern does not have parameter '$nameOrPosition'");
313 310
         }
314 311
 
@@ -355,8 +352,7 @@  discard block
 block discarded – undo
355 352
             $names = array_keys($this->unsatisfiedParams);
356 353
             if (count($names) == 1) {
357 354
                 $msg = sprintf('Value for parameter "%s" has not been set.', $names[0]);
358
-            }
359
-            else {
355
+            } else {
360 356
                 $msg = sprintf(
361 357
                     'Values for parameters %s and "%s" have not been set.',
362 358
                     array_map(function ($s) { return "\"$s\""; }, array_slice($names, 0, -1))
@@ -386,14 +382,12 @@  discard block
 block discarded – undo
386 382
                     if (!$placeholder->isSchemaNameQuoted()) {
387 383
                         $schemaName = mb_strtolower($schemaName); // OPT: SqlPatternPlaceholder might also store the lower-case name, which might be cached
388 384
                     }
389
-                }
390
-                elseif ($placeholder->isTypeNameQuoted()) {
385
+                } elseif ($placeholder->isTypeNameQuoted()) {
391 386
                     $schemaName = false;
392 387
                 }
393 388
 
394 389
                 $converter = $typeDictionary->requireTypeByName($typeName, $schemaName);
395
-            }
396
-            else {
390
+            } else {
397 391
                 $converter = $typeDictionary->requireTypeByValue($value);
398 392
             }
399 393
             $serializedValue = $converter->serializeValue($value);
Please login to merge, or discard this patch.
src/Ivory/Lang/SqlPattern/SqlPatternParser.php 3 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,12 +13,12 @@  discard block
 block discarded – undo
13 13
      */
14 14
     public function parse(string $sqlPattern) : SqlPattern
15 15
     {
16
-	    $positionalPlaceholders = [];
17
-	    $namedPlaceholderMap = [];
18
-	    $rawOffsetDelta = 0;
16
+        $positionalPlaceholders = [];
17
+        $namedPlaceholderMap = [];
18
+        $rawOffsetDelta = 0;
19 19
 
20
-	    $sqlTorso = StringUtils::pregReplaceCallbackWithOffset(
21
-	    	'~
20
+        $sqlTorso = StringUtils::pregReplaceCallbackWithOffset(
21
+            '~
22 22
 	    	  %                                             # the percent sign introducing the sequence
23 23
 	    	  (?: (?! % )                                   # anything but another percent sign -> placeholder
24 24
 	    	      (?:                                       #   optional type specification
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 	    	    ( % )                                       # another percent sign -> literal %
46 46
 	    	  )
47 47
 	    	 ~xu',
48
-		    function ($matchWithOffsets) use (&$positionalPlaceholders, &$namedPlaceholderMap, &$rawOffsetDelta) {
49
-			    if (isset($matchWithOffsets[6])) {
50
-				    $rawOffsetDelta--; // put one character instead of two
51
-				    return '%';
52
-			    }
48
+            function ($matchWithOffsets) use (&$positionalPlaceholders, &$namedPlaceholderMap, &$rawOffsetDelta) {
49
+                if (isset($matchWithOffsets[6])) {
50
+                    $rawOffsetDelta--; // put one character instead of two
51
+                    return '%';
52
+                }
53 53
 
54 54
                 $offset = $matchWithOffsets[0][1] + $rawOffsetDelta;
55 55
 
56
-			    if (strlen(($matchWithOffsets[3][0] ?? '')) > 0) {
57
-			        $schemaName = null;
58
-			        $schemaNameQuoted = false;
56
+                if (strlen(($matchWithOffsets[3][0] ?? '')) > 0) {
57
+                    $schemaName = null;
58
+                    $schemaNameQuoted = false;
59 59
                     $typeName = $matchWithOffsets[3][0];
60 60
                     $typeNameQuoted = false;
61 61
                 }
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
                 }
85 85
                 $rawOffsetDelta -= strlen($matchWithOffsets[0][0]); // put no characters instead of the whole match
86 86
                 return '';
87
-		    },
88
-		    $sqlPattern
89
-	    );
87
+            },
88
+            $sqlPattern
89
+        );
90 90
 
91
-	    return new SqlPattern($sqlTorso, $positionalPlaceholders, $namedPlaceholderMap);
91
+        return new SqlPattern($sqlTorso, $positionalPlaceholders, $namedPlaceholderMap);
92 92
     }
93 93
 
94 94
     private function unquoteString($str, &$quoted = null)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	    	    ( % )                                       # another percent sign -> literal %
46 46
 	    	  )
47 47
 	    	 ~xu',
48
-		    function ($matchWithOffsets) use (&$positionalPlaceholders, &$namedPlaceholderMap, &$rawOffsetDelta) {
48
+		    function($matchWithOffsets) use (&$positionalPlaceholders, &$namedPlaceholderMap, &$rawOffsetDelta) {
49 49
 			    if (isset($matchWithOffsets[6])) {
50 50
 				    $rawOffsetDelta--; // put one character instead of two
51 51
 				    return '%';
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
 			        $schemaNameQuoted = false;
59 59
                     $typeName = $matchWithOffsets[3][0];
60 60
                     $typeNameQuoted = false;
61
-                }
62
-                else {
61
+                } else {
63 62
                     $schemaItem = (!empty($matchWithOffsets[1][0]) ? $matchWithOffsets[1][0] : null); // correctness: empty() is OK as the schema name may not be "0"
64 63
                     $schemaName = $this->unquoteString($schemaItem, $schemaNameQuoted);
65 64
                     $typeItem = (!empty($matchWithOffsets[2][0]) ? $matchWithOffsets[2][0] : null); // correctness: empty() is OK as the type name may not be "0"
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
                         $namedPlaceholderMap[$name] = [];
77 76
                     }
78 77
                     $namedPlaceholderMap[$name][] = $plcHld;
79
-                }
80
-                else {
78
+                } else {
81 79
                     $pos = count($positionalPlaceholders);
82 80
                     $plcHld = new SqlPatternPlaceholder($offset, $pos, $typeName, $typeNameQuoted, $schemaName, $schemaNameQuoted);
83 81
                     $positionalPlaceholders[] = $plcHld;
@@ -97,8 +95,7 @@  discard block
 block discarded – undo
97 95
             assert($str[strlen($str) - 1] == '"');
98 96
             $quoted = true;
99 97
             return str_replace('""', '"', substr($str, 1, -1));
100
-        }
101
-        else {
98
+        } else {
102 99
             $quoted = false;
103 100
             return $str;
104 101
         }
Please login to merge, or discard this patch.
src/Ivory/Lang/Sql/Keywords.php 1 patch
Indentation   +465 added lines, -465 removed lines patch added patch discarded remove patch
@@ -14,472 +14,472 @@
 block discarded – undo
14 14
  */
15 15
 class Keywords
16 16
 {
17
-	/**
18
-	 * Tells whether a given word is a non-reserved keyword.
19
-	 *
20
-	 * @param string $keyword
21
-	 * @return bool
22
-	 */
23
-	public static function isUnreserved($keyword)
24
-	{
25
-		static $hash = [
26
-				'abort' => true,
27
-				'absolute' => true,
28
-				'access' => true,
29
-				'action' => true,
30
-				'add' => true,
31
-				'admin' => true,
32
-				'after' => true,
33
-				'aggregate' => true,
34
-				'also' => true,
35
-				'alter' => true,
36
-				'always' => true,
37
-				'assertion' => true,
38
-				'assignment' => true,
39
-				'at' => true,
40
-				'attribute' => true,
41
-				'backward' => true,
42
-				'before' => true,
43
-				'begin' => true,
44
-				'by' => true,
45
-				'cache' => true,
46
-				'called' => true,
47
-				'cascade' => true,
48
-				'cascaded' => true,
49
-				'catalog' => true,
50
-				'chain' => true,
51
-				'characteristics' => true,
52
-				'checkpoint' => true,
53
-				'class' => true,
54
-				'close' => true,
55
-				'cluster' => true,
56
-				'comment' => true,
57
-				'comments' => true,
58
-				'commit' => true,
59
-				'committed' => true,
60
-				'configuration' => true,
61
-				'conflict' => true,
62
-				'connection' => true,
63
-				'constraints' => true,
64
-				'content' => true,
65
-				'continue' => true,
66
-				'conversion' => true,
67
-				'copy' => true,
68
-				'cost' => true,
69
-				'csv' => true,
70
-				'cube' => true,
71
-				'current' => true,
72
-				'cursor' => true,
73
-				'cycle' => true,
74
-				'data' => true,
75
-				'database' => true,
76
-				'day' => true,
77
-				'deallocate' => true,
78
-				'declare' => true,
79
-				'defaults' => true,
80
-				'deferred' => true,
81
-				'definer' => true,
82
-				'delete' => true,
83
-				'delimiter' => true,
84
-				'delimiters' => true,
85
-				'dictionary' => true,
86
-				'disable' => true,
87
-				'discard' => true,
88
-				'document' => true,
89
-				'domain' => true,
90
-				'double' => true,
91
-				'drop' => true,
92
-				'each' => true,
93
-				'enable' => true,
94
-				'encoding' => true,
95
-				'encrypted' => true,
96
-				'enum' => true,
97
-				'escape' => true,
98
-				'event' => true,
99
-				'exclude' => true,
100
-				'excluding' => true,
101
-				'exclusive' => true,
102
-				'execute' => true,
103
-				'explain' => true,
104
-				'extension' => true,
105
-				'external' => true,
106
-				'family' => true,
107
-				'filter' => true,
108
-				'first' => true,
109
-				'following' => true,
110
-				'force' => true,
111
-				'forward' => true,
112
-				'function' => true,
113
-				'functions' => true,
114
-				'global' => true,
115
-				'granted' => true,
116
-				'handler' => true,
117
-				'header' => true,
118
-				'hold' => true,
119
-				'hour' => true,
120
-				'identity' => true,
121
-				'if' => true,
122
-				'immediate' => true,
123
-				'immutable' => true,
124
-				'implicit' => true,
125
-				'import' => true,
126
-				'including' => true,
127
-				'increment' => true,
128
-				'index' => true,
129
-				'indexes' => true,
130
-				'inherit' => true,
131
-				'inherits' => true,
132
-				'inline' => true,
133
-				'input' => true,
134
-				'insensitive' => true,
135
-				'insert' => true,
136
-				'instead' => true,
137
-				'invoker' => true,
138
-				'isolation' => true,
139
-				'key' => true,
140
-				'label' => true,
141
-				'language' => true,
142
-				'large' => true,
143
-				'last' => true,
144
-				'leakproof' => true,
145
-				'level' => true,
146
-				'listen' => true,
147
-				'load' => true,
148
-				'local' => true,
149
-				'location' => true,
150
-				'lock' => true,
151
-				'locked' => true,
152
-				'logged' => true,
153
-				'mapping' => true,
154
-				'match' => true,
155
-				'materialized' => true,
156
-				'maxvalue' => true,
157
-				'minute' => true,
158
-				'minvalue' => true,
159
-				'mode' => true,
160
-				'month' => true,
161
-				'move' => true,
162
-				'name' => true,
163
-				'names' => true,
164
-				'next' => true,
165
-				'no' => true,
166
-				'nothing' => true,
167
-				'notify' => true,
168
-				'nowait' => true,
169
-				'nulls' => true,
170
-				'object' => true,
171
-				'of' => true,
172
-				'off' => true,
173
-				'oids' => true,
174
-				'operator' => true,
175
-				'option' => true,
176
-				'options' => true,
177
-				'ordinality' => true,
178
-				'over' => true,
179
-				'owned' => true,
180
-				'owner' => true,
181
-				'parallel' => true,
182
-				'parser' => true,
183
-				'partial' => true,
184
-				'partition' => true,
185
-				'passing' => true,
186
-				'password' => true,
187
-				'plans' => true,
188
-				'policy' => true,
189
-				'preceding' => true,
190
-				'prepare' => true,
191
-				'prepared' => true,
192
-				'preserve' => true,
193
-				'prior' => true,
194
-				'privileges' => true,
195
-				'procedural' => true,
196
-				'procedure' => true,
197
-				'program' => true,
198
-				'quote' => true,
199
-				'range' => true,
200
-				'read' => true,
201
-				'reassign' => true,
202
-				'recheck' => true,
203
-				'recursive' => true,
204
-				'ref' => true,
205
-				'refresh' => true,
206
-				'reindex' => true,
207
-				'relative' => true,
208
-				'release' => true,
209
-				'rename' => true,
210
-				'repeatable' => true,
211
-				'replace' => true,
212
-				'replica' => true,
213
-				'reset' => true,
214
-				'restart' => true,
215
-				'restrict' => true,
216
-				'returns' => true,
217
-				'revoke' => true,
218
-				'role' => true,
219
-				'rollback' => true,
220
-				'rollup' => true,
221
-				'rows' => true,
222
-				'rule' => true,
223
-				'savepoint' => true,
224
-				'schema' => true,
225
-				'scroll' => true,
226
-				'search' => true,
227
-				'second' => true,
228
-				'security' => true,
229
-				'sequence' => true,
230
-				'sequences' => true,
231
-				'serializable' => true,
232
-				'server' => true,
233
-				'session' => true,
234
-				'set' => true,
235
-				'sets' => true,
236
-				'share' => true,
237
-				'show' => true,
238
-				'simple' => true,
239
-				'skip' => true,
240
-				'snapshot' => true,
241
-				'sql' => true,
242
-				'stable' => true,
243
-				'standalone' => true,
244
-				'start' => true,
245
-				'statement' => true,
246
-				'statistics' => true,
247
-				'stdin' => true,
248
-				'stdout' => true,
249
-				'storage' => true,
250
-				'strict' => true,
251
-				'strip' => true,
252
-				'sysid' => true,
253
-				'system' => true,
254
-				'tables' => true,
255
-				'tablespace' => true,
256
-				'temp' => true,
257
-				'template' => true,
258
-				'temporary' => true,
259
-				'text' => true,
260
-				'transaction' => true,
261
-				'transform' => true,
262
-				'trigger' => true,
263
-				'truncate' => true,
264
-				'trusted' => true,
265
-				'type' => true,
266
-				'types' => true,
267
-				'unbounded' => true,
268
-				'uncommitted' => true,
269
-				'unencrypted' => true,
270
-				'unknown' => true,
271
-				'unlisten' => true,
272
-				'unlogged' => true,
273
-				'until' => true,
274
-				'update' => true,
275
-				'vacuum' => true,
276
-				'valid' => true,
277
-				'validate' => true,
278
-				'validator' => true,
279
-				'value' => true,
280
-				'varying' => true,
281
-				'version' => true,
282
-				'view' => true,
283
-				'views' => true,
284
-				'volatile' => true,
285
-				'whitespace' => true,
286
-				'within' => true,
287
-				'without' => true,
288
-				'work' => true,
289
-				'wrapper' => true,
290
-				'write' => true,
291
-				'xml' => true,
292
-				'year' => true,
293
-				'yes' => true,
294
-				'zone' => true,
295
-		];
296
-		return isset($hash[strtolower($keyword)]);
297
-	}
17
+    /**
18
+     * Tells whether a given word is a non-reserved keyword.
19
+     *
20
+     * @param string $keyword
21
+     * @return bool
22
+     */
23
+    public static function isUnreserved($keyword)
24
+    {
25
+        static $hash = [
26
+                'abort' => true,
27
+                'absolute' => true,
28
+                'access' => true,
29
+                'action' => true,
30
+                'add' => true,
31
+                'admin' => true,
32
+                'after' => true,
33
+                'aggregate' => true,
34
+                'also' => true,
35
+                'alter' => true,
36
+                'always' => true,
37
+                'assertion' => true,
38
+                'assignment' => true,
39
+                'at' => true,
40
+                'attribute' => true,
41
+                'backward' => true,
42
+                'before' => true,
43
+                'begin' => true,
44
+                'by' => true,
45
+                'cache' => true,
46
+                'called' => true,
47
+                'cascade' => true,
48
+                'cascaded' => true,
49
+                'catalog' => true,
50
+                'chain' => true,
51
+                'characteristics' => true,
52
+                'checkpoint' => true,
53
+                'class' => true,
54
+                'close' => true,
55
+                'cluster' => true,
56
+                'comment' => true,
57
+                'comments' => true,
58
+                'commit' => true,
59
+                'committed' => true,
60
+                'configuration' => true,
61
+                'conflict' => true,
62
+                'connection' => true,
63
+                'constraints' => true,
64
+                'content' => true,
65
+                'continue' => true,
66
+                'conversion' => true,
67
+                'copy' => true,
68
+                'cost' => true,
69
+                'csv' => true,
70
+                'cube' => true,
71
+                'current' => true,
72
+                'cursor' => true,
73
+                'cycle' => true,
74
+                'data' => true,
75
+                'database' => true,
76
+                'day' => true,
77
+                'deallocate' => true,
78
+                'declare' => true,
79
+                'defaults' => true,
80
+                'deferred' => true,
81
+                'definer' => true,
82
+                'delete' => true,
83
+                'delimiter' => true,
84
+                'delimiters' => true,
85
+                'dictionary' => true,
86
+                'disable' => true,
87
+                'discard' => true,
88
+                'document' => true,
89
+                'domain' => true,
90
+                'double' => true,
91
+                'drop' => true,
92
+                'each' => true,
93
+                'enable' => true,
94
+                'encoding' => true,
95
+                'encrypted' => true,
96
+                'enum' => true,
97
+                'escape' => true,
98
+                'event' => true,
99
+                'exclude' => true,
100
+                'excluding' => true,
101
+                'exclusive' => true,
102
+                'execute' => true,
103
+                'explain' => true,
104
+                'extension' => true,
105
+                'external' => true,
106
+                'family' => true,
107
+                'filter' => true,
108
+                'first' => true,
109
+                'following' => true,
110
+                'force' => true,
111
+                'forward' => true,
112
+                'function' => true,
113
+                'functions' => true,
114
+                'global' => true,
115
+                'granted' => true,
116
+                'handler' => true,
117
+                'header' => true,
118
+                'hold' => true,
119
+                'hour' => true,
120
+                'identity' => true,
121
+                'if' => true,
122
+                'immediate' => true,
123
+                'immutable' => true,
124
+                'implicit' => true,
125
+                'import' => true,
126
+                'including' => true,
127
+                'increment' => true,
128
+                'index' => true,
129
+                'indexes' => true,
130
+                'inherit' => true,
131
+                'inherits' => true,
132
+                'inline' => true,
133
+                'input' => true,
134
+                'insensitive' => true,
135
+                'insert' => true,
136
+                'instead' => true,
137
+                'invoker' => true,
138
+                'isolation' => true,
139
+                'key' => true,
140
+                'label' => true,
141
+                'language' => true,
142
+                'large' => true,
143
+                'last' => true,
144
+                'leakproof' => true,
145
+                'level' => true,
146
+                'listen' => true,
147
+                'load' => true,
148
+                'local' => true,
149
+                'location' => true,
150
+                'lock' => true,
151
+                'locked' => true,
152
+                'logged' => true,
153
+                'mapping' => true,
154
+                'match' => true,
155
+                'materialized' => true,
156
+                'maxvalue' => true,
157
+                'minute' => true,
158
+                'minvalue' => true,
159
+                'mode' => true,
160
+                'month' => true,
161
+                'move' => true,
162
+                'name' => true,
163
+                'names' => true,
164
+                'next' => true,
165
+                'no' => true,
166
+                'nothing' => true,
167
+                'notify' => true,
168
+                'nowait' => true,
169
+                'nulls' => true,
170
+                'object' => true,
171
+                'of' => true,
172
+                'off' => true,
173
+                'oids' => true,
174
+                'operator' => true,
175
+                'option' => true,
176
+                'options' => true,
177
+                'ordinality' => true,
178
+                'over' => true,
179
+                'owned' => true,
180
+                'owner' => true,
181
+                'parallel' => true,
182
+                'parser' => true,
183
+                'partial' => true,
184
+                'partition' => true,
185
+                'passing' => true,
186
+                'password' => true,
187
+                'plans' => true,
188
+                'policy' => true,
189
+                'preceding' => true,
190
+                'prepare' => true,
191
+                'prepared' => true,
192
+                'preserve' => true,
193
+                'prior' => true,
194
+                'privileges' => true,
195
+                'procedural' => true,
196
+                'procedure' => true,
197
+                'program' => true,
198
+                'quote' => true,
199
+                'range' => true,
200
+                'read' => true,
201
+                'reassign' => true,
202
+                'recheck' => true,
203
+                'recursive' => true,
204
+                'ref' => true,
205
+                'refresh' => true,
206
+                'reindex' => true,
207
+                'relative' => true,
208
+                'release' => true,
209
+                'rename' => true,
210
+                'repeatable' => true,
211
+                'replace' => true,
212
+                'replica' => true,
213
+                'reset' => true,
214
+                'restart' => true,
215
+                'restrict' => true,
216
+                'returns' => true,
217
+                'revoke' => true,
218
+                'role' => true,
219
+                'rollback' => true,
220
+                'rollup' => true,
221
+                'rows' => true,
222
+                'rule' => true,
223
+                'savepoint' => true,
224
+                'schema' => true,
225
+                'scroll' => true,
226
+                'search' => true,
227
+                'second' => true,
228
+                'security' => true,
229
+                'sequence' => true,
230
+                'sequences' => true,
231
+                'serializable' => true,
232
+                'server' => true,
233
+                'session' => true,
234
+                'set' => true,
235
+                'sets' => true,
236
+                'share' => true,
237
+                'show' => true,
238
+                'simple' => true,
239
+                'skip' => true,
240
+                'snapshot' => true,
241
+                'sql' => true,
242
+                'stable' => true,
243
+                'standalone' => true,
244
+                'start' => true,
245
+                'statement' => true,
246
+                'statistics' => true,
247
+                'stdin' => true,
248
+                'stdout' => true,
249
+                'storage' => true,
250
+                'strict' => true,
251
+                'strip' => true,
252
+                'sysid' => true,
253
+                'system' => true,
254
+                'tables' => true,
255
+                'tablespace' => true,
256
+                'temp' => true,
257
+                'template' => true,
258
+                'temporary' => true,
259
+                'text' => true,
260
+                'transaction' => true,
261
+                'transform' => true,
262
+                'trigger' => true,
263
+                'truncate' => true,
264
+                'trusted' => true,
265
+                'type' => true,
266
+                'types' => true,
267
+                'unbounded' => true,
268
+                'uncommitted' => true,
269
+                'unencrypted' => true,
270
+                'unknown' => true,
271
+                'unlisten' => true,
272
+                'unlogged' => true,
273
+                'until' => true,
274
+                'update' => true,
275
+                'vacuum' => true,
276
+                'valid' => true,
277
+                'validate' => true,
278
+                'validator' => true,
279
+                'value' => true,
280
+                'varying' => true,
281
+                'version' => true,
282
+                'view' => true,
283
+                'views' => true,
284
+                'volatile' => true,
285
+                'whitespace' => true,
286
+                'within' => true,
287
+                'without' => true,
288
+                'work' => true,
289
+                'wrapper' => true,
290
+                'write' => true,
291
+                'xml' => true,
292
+                'year' => true,
293
+                'yes' => true,
294
+                'zone' => true,
295
+        ];
296
+        return isset($hash[strtolower($keyword)]);
297
+    }
298 298
 
299
-	/**
300
-	 * Tells whether a given word is a non-reserved keyword, although it cannot be used as a function or type name.
301
-	 *
302
-	 * @param string $keyword
303
-	 * @return bool
304
-	 */
305
-	public static function isColName($keyword)
306
-	{
307
-		static $hash = [
308
-				'between' => true,
309
-				'bigint' => true,
310
-				'bit' => true,
311
-				'boolean' => true,
312
-				'char' => true,
313
-				'character' => true,
314
-				'coalesce' => true,
315
-				'dec' => true,
316
-				'decimal' => true,
317
-				'exists' => true,
318
-				'extract' => true,
319
-				'float' => true,
320
-				'greatest' => true,
321
-				'grouping' => true,
322
-				'inout' => true,
323
-				'int' => true,
324
-				'integer' => true,
325
-				'interval' => true,
326
-				'least' => true,
327
-				'national' => true,
328
-				'nchar' => true,
329
-				'none' => true,
330
-				'nullif' => true,
331
-				'numeric' => true,
332
-				'out' => true,
333
-				'overlay' => true,
334
-				'position' => true,
335
-				'precision' => true,
336
-				'real' => true,
337
-				'row' => true,
338
-				'setof' => true,
339
-				'smallint' => true,
340
-				'substring' => true,
341
-				'time' => true,
342
-				'timestamp' => true,
343
-				'treat' => true,
344
-				'trim' => true,
345
-				'values' => true,
346
-				'varchar' => true,
347
-				'xmlattributes' => true,
348
-				'xmlconcat' => true,
349
-				'xmlelement' => true,
350
-				'xmlexists' => true,
351
-				'xmlforest' => true,
352
-				'xmlparse' => true,
353
-				'xmlpi' => true,
354
-				'xmlroot' => true,
355
-				'xmlserialize' => true,
356
-		];
357
-		return isset($hash[strtolower($keyword)]);
358
-	}
299
+    /**
300
+     * Tells whether a given word is a non-reserved keyword, although it cannot be used as a function or type name.
301
+     *
302
+     * @param string $keyword
303
+     * @return bool
304
+     */
305
+    public static function isColName($keyword)
306
+    {
307
+        static $hash = [
308
+                'between' => true,
309
+                'bigint' => true,
310
+                'bit' => true,
311
+                'boolean' => true,
312
+                'char' => true,
313
+                'character' => true,
314
+                'coalesce' => true,
315
+                'dec' => true,
316
+                'decimal' => true,
317
+                'exists' => true,
318
+                'extract' => true,
319
+                'float' => true,
320
+                'greatest' => true,
321
+                'grouping' => true,
322
+                'inout' => true,
323
+                'int' => true,
324
+                'integer' => true,
325
+                'interval' => true,
326
+                'least' => true,
327
+                'national' => true,
328
+                'nchar' => true,
329
+                'none' => true,
330
+                'nullif' => true,
331
+                'numeric' => true,
332
+                'out' => true,
333
+                'overlay' => true,
334
+                'position' => true,
335
+                'precision' => true,
336
+                'real' => true,
337
+                'row' => true,
338
+                'setof' => true,
339
+                'smallint' => true,
340
+                'substring' => true,
341
+                'time' => true,
342
+                'timestamp' => true,
343
+                'treat' => true,
344
+                'trim' => true,
345
+                'values' => true,
346
+                'varchar' => true,
347
+                'xmlattributes' => true,
348
+                'xmlconcat' => true,
349
+                'xmlelement' => true,
350
+                'xmlexists' => true,
351
+                'xmlforest' => true,
352
+                'xmlparse' => true,
353
+                'xmlpi' => true,
354
+                'xmlroot' => true,
355
+                'xmlserialize' => true,
356
+        ];
357
+        return isset($hash[strtolower($keyword)]);
358
+    }
359 359
 
360
-	/**
361
-	 * Tells whether a given word is a reserved keyword, although may be used as a function or type name.
362
-	 *
363
-	 * @param string $keyword
364
-	 * @return bool
365
-	 */
366
-	public static function isTypeOrFuncName($keyword)
367
-	{
368
-		static $hash = [
369
-				'authorization' => true,
370
-				'binary' => true,
371
-				'collation' => true,
372
-				'concurrently' => true,
373
-				'cross' => true,
374
-				'current_schema' => true,
375
-				'freeze' => true,
376
-				'full' => true,
377
-				'ilike' => true,
378
-				'inner' => true,
379
-				'is' => true,
380
-				'isnull' => true,
381
-				'join' => true,
382
-				'left' => true,
383
-				'like' => true,
384
-				'natural' => true,
385
-				'notnull' => true,
386
-				'outer' => true,
387
-				'overlaps' => true,
388
-				'right' => true,
389
-				'similar' => true,
390
-				'tablesample' => true,
391
-				'verbose' => true,
392
-		];
393
-		return isset($hash[strtolower($keyword)]);
394
-	}
360
+    /**
361
+     * Tells whether a given word is a reserved keyword, although may be used as a function or type name.
362
+     *
363
+     * @param string $keyword
364
+     * @return bool
365
+     */
366
+    public static function isTypeOrFuncName($keyword)
367
+    {
368
+        static $hash = [
369
+                'authorization' => true,
370
+                'binary' => true,
371
+                'collation' => true,
372
+                'concurrently' => true,
373
+                'cross' => true,
374
+                'current_schema' => true,
375
+                'freeze' => true,
376
+                'full' => true,
377
+                'ilike' => true,
378
+                'inner' => true,
379
+                'is' => true,
380
+                'isnull' => true,
381
+                'join' => true,
382
+                'left' => true,
383
+                'like' => true,
384
+                'natural' => true,
385
+                'notnull' => true,
386
+                'outer' => true,
387
+                'overlaps' => true,
388
+                'right' => true,
389
+                'similar' => true,
390
+                'tablesample' => true,
391
+                'verbose' => true,
392
+        ];
393
+        return isset($hash[strtolower($keyword)]);
394
+    }
395 395
 
396
-	/**
397
-	 * Tells whether a given word is a reserved keyword.
398
-	 *
399
-	 * @param string $keyword
400
-	 * @return bool
401
-	 */
402
-	public static function isReserved($keyword)
403
-	{
404
-		$hash = [
405
-				'all' => true,
406
-				'analyse' => true,
407
-				'analyze' => true,
408
-				'and' => true,
409
-				'any' => true,
410
-				'array' => true,
411
-				'as' => true,
412
-				'asc' => true,
413
-				'asymmetric' => true,
414
-				'both' => true,
415
-				'case' => true,
416
-				'cast' => true,
417
-				'check' => true,
418
-				'collate' => true,
419
-				'column' => true,
420
-				'constraint' => true,
421
-				'create' => true,
422
-				'current_catalog' => true,
423
-				'current_date' => true,
424
-				'current_role' => true,
425
-				'current_time' => true,
426
-				'current_timestamp' => true,
427
-				'current_user' => true,
428
-				'default' => true,
429
-				'deferrable' => true,
430
-				'desc' => true,
431
-				'distinct' => true,
432
-				'do' => true,
433
-				'else' => true,
434
-				'end' => true,
435
-				'except' => true,
436
-				'false' => true,
437
-				'fetch' => true,
438
-				'for' => true,
439
-				'foreign' => true,
440
-				'from' => true,
441
-				'grant' => true,
442
-				'group' => true,
443
-				'having' => true,
444
-				'in' => true,
445
-				'initially' => true,
446
-				'intersect' => true,
447
-				'into' => true,
448
-				'lateral' => true,
449
-				'leading' => true,
450
-				'limit' => true,
451
-				'localtime' => true,
452
-				'localtimestamp' => true,
453
-				'not' => true,
454
-				'null' => true,
455
-				'offset' => true,
456
-				'on' => true,
457
-				'only' => true,
458
-				'or' => true,
459
-				'order' => true,
460
-				'placing' => true,
461
-				'primary' => true,
462
-				'references' => true,
463
-				'returning' => true,
464
-				'select' => true,
465
-				'session_user' => true,
466
-				'some' => true,
467
-				'symmetric' => true,
468
-				'table' => true,
469
-				'then' => true,
470
-				'to' => true,
471
-				'trailing' => true,
472
-				'true' => true,
473
-				'union' => true,
474
-				'unique' => true,
475
-				'user' => true,
476
-				'using' => true,
477
-				'variadic' => true,
478
-				'when' => true,
479
-				'where' => true,
480
-				'window' => true,
481
-				'with' => true,
482
-		];
483
-		return isset($hash[strtolower($keyword)]);
484
-	}
396
+    /**
397
+     * Tells whether a given word is a reserved keyword.
398
+     *
399
+     * @param string $keyword
400
+     * @return bool
401
+     */
402
+    public static function isReserved($keyword)
403
+    {
404
+        $hash = [
405
+                'all' => true,
406
+                'analyse' => true,
407
+                'analyze' => true,
408
+                'and' => true,
409
+                'any' => true,
410
+                'array' => true,
411
+                'as' => true,
412
+                'asc' => true,
413
+                'asymmetric' => true,
414
+                'both' => true,
415
+                'case' => true,
416
+                'cast' => true,
417
+                'check' => true,
418
+                'collate' => true,
419
+                'column' => true,
420
+                'constraint' => true,
421
+                'create' => true,
422
+                'current_catalog' => true,
423
+                'current_date' => true,
424
+                'current_role' => true,
425
+                'current_time' => true,
426
+                'current_timestamp' => true,
427
+                'current_user' => true,
428
+                'default' => true,
429
+                'deferrable' => true,
430
+                'desc' => true,
431
+                'distinct' => true,
432
+                'do' => true,
433
+                'else' => true,
434
+                'end' => true,
435
+                'except' => true,
436
+                'false' => true,
437
+                'fetch' => true,
438
+                'for' => true,
439
+                'foreign' => true,
440
+                'from' => true,
441
+                'grant' => true,
442
+                'group' => true,
443
+                'having' => true,
444
+                'in' => true,
445
+                'initially' => true,
446
+                'intersect' => true,
447
+                'into' => true,
448
+                'lateral' => true,
449
+                'leading' => true,
450
+                'limit' => true,
451
+                'localtime' => true,
452
+                'localtimestamp' => true,
453
+                'not' => true,
454
+                'null' => true,
455
+                'offset' => true,
456
+                'on' => true,
457
+                'only' => true,
458
+                'or' => true,
459
+                'order' => true,
460
+                'placing' => true,
461
+                'primary' => true,
462
+                'references' => true,
463
+                'returning' => true,
464
+                'select' => true,
465
+                'session_user' => true,
466
+                'some' => true,
467
+                'symmetric' => true,
468
+                'table' => true,
469
+                'then' => true,
470
+                'to' => true,
471
+                'trailing' => true,
472
+                'true' => true,
473
+                'union' => true,
474
+                'unique' => true,
475
+                'user' => true,
476
+                'using' => true,
477
+                'variadic' => true,
478
+                'when' => true,
479
+                'where' => true,
480
+                'window' => true,
481
+                'with' => true,
482
+        ];
483
+        return isset($hash[strtolower($keyword)]);
484
+    }
485 485
 }
Please login to merge, or discard this patch.