@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | { |
31 | 31 | if (!is_string($file)) { |
32 | 32 | throw new InvalidArgumentException( |
33 | - "Invalid type '" . gettype($file) . "' for argument 'file'." |
|
33 | + "Invalid type '".gettype($file)."' for argument 'file'." |
|
34 | 34 | ); |
35 | 35 | } |
36 | 36 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | if (!is_string($file)) { |
57 | 57 | throw new InvalidArgumentException( |
58 | - "Invalid type '" . gettype($file) . "' for argument 'file'." |
|
58 | + "Invalid type '".gettype($file)."' for argument 'file'." |
|
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | { |
80 | 80 | if (!is_string($file)) { |
81 | 81 | throw new InvalidArgumentException( |
82 | - "Invalid type '" . gettype($file) . "' for argument 'file'." |
|
82 | + "Invalid type '".gettype($file)."' for argument 'file'." |
|
83 | 83 | ); |
84 | 84 | } |
85 | 85 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | if (!is_string($pattern)) { |
35 | 35 | throw new InvalidArgumentException( |
36 | - "Invalid type '" . gettype($pattern) . "' for argument 'pattern'." |
|
36 | + "Invalid type '".gettype($pattern)."' for argument 'pattern'." |
|
37 | 37 | ); |
38 | 38 | } |
39 | 39 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | { |
58 | 58 | if (!is_string($pattern)) { |
59 | 59 | throw new InvalidArgumentException( |
60 | - "Invalid type '" . gettype($pattern) . "' for argument 'pattern'." |
|
60 | + "Invalid type '".gettype($pattern)."' for argument 'pattern'." |
|
61 | 61 | ); |
62 | 62 | } |
63 | 63 | |
@@ -100,12 +100,12 @@ discard block |
||
100 | 100 | { |
101 | 101 | if (!is_string($key)) { |
102 | 102 | throw new InvalidArgumentException( |
103 | - "Invalid type '" . gettype($key) . "' for argument 'key'." |
|
103 | + "Invalid type '".gettype($key)."' for argument 'key'." |
|
104 | 104 | ); |
105 | 105 | } |
106 | 106 | if (!is_string($value)) { |
107 | 107 | throw new InvalidArgumentException( |
108 | - "Invalid type '" . gettype($value) . "' for argument 'value'." |
|
108 | + "Invalid type '".gettype($value)."' for argument 'value'." |
|
109 | 109 | ); |
110 | 110 | } |
111 | 111 |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | { |
49 | 49 | if (!is_string($sourceUri)) { |
50 | 50 | throw new InvalidArgumentException( |
51 | - "Invalid type '" . gettype($sourceUri) . "' for argument 'sourceUri'." |
|
51 | + "Invalid type '".gettype($sourceUri)."' for argument 'sourceUri'." |
|
52 | 52 | ); |
53 | 53 | } |
54 | 54 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | { |
97 | 97 | if (!is_string($sourceUri)) { |
98 | 98 | throw new InvalidArgumentException( |
99 | - "Invalid type '" . gettype($sourceUri) . "' for argument 'sourceUri'." |
|
99 | + "Invalid type '".gettype($sourceUri)."' for argument 'sourceUri'." |
|
100 | 100 | ); |
101 | 101 | } |
102 | 102 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // Check status code |
151 | 151 | if ($response->getStatusCode() !== 200) { |
152 | 152 | throw new SourceUnavailableException( |
153 | - 'HTTP error: ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase(), |
|
153 | + 'HTTP error: '.$response->getStatusCode().' '.$response->getReasonPhrase(), |
|
154 | 154 | 1459162268 |
155 | 155 | ); |
156 | 156 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | self::$sourceClasses = $rememberClasses; |
57 | 57 | |
58 | 58 | throw new InvalidArgumentException( |
59 | - "A value in the class name array is of type '" . gettype($className) . "'. String expected." |
|
59 | + "A value in the class name array is of type '".gettype($className)."'. String expected." |
|
60 | 60 | ); |
61 | 61 | } |
62 | 62 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | if (!is_string($className)) { |
75 | 75 | throw new InvalidArgumentException( |
76 | - "Invalid type '" . gettype($className) . "' for argument 'className'." |
|
76 | + "Invalid type '".gettype($className)."' for argument 'className'." |
|
77 | 77 | ); |
78 | 78 | } |
79 | 79 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | { |
43 | 43 | if (!is_int($type)) { |
44 | 44 | throw new InvalidArgumentException( |
45 | - "Invalid type '" . gettype($type) . "' for argument 'type'." |
|
45 | + "Invalid type '".gettype($type)."' for argument 'type'." |
|
46 | 46 | ); |
47 | 47 | } |
48 | 48 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function getReleaseTime() |
60 | 60 | { |
61 | - $stream = $this->loadContent(self::BASE_URI . '/version'); |
|
61 | + $stream = $this->loadContent(self::BASE_URI.'/version'); |
|
62 | 62 | |
63 | 63 | if (!$stream->isReadable()) { |
64 | 64 | throw new SourceUnavailableException('Source stream is not readable.', 1459162265); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getVersion() |
77 | 77 | { |
78 | - $stream = $this->loadContent(self::BASE_URI . '/version-number'); |
|
78 | + $stream = $this->loadContent(self::BASE_URI.'/version-number'); |
|
79 | 79 | |
80 | 80 | if (!$stream->isReadable()) { |
81 | 81 | throw new SourceUnavailableException('Source stream is not readable.', 1459162266); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | { |
95 | 95 | if (!is_int($type)) { |
96 | 96 | throw new InvalidArgumentException( |
97 | - "Invalid type '" . gettype($type) . "' for argument 'type'." |
|
97 | + "Invalid type '".gettype($type)."' for argument 'type'." |
|
98 | 98 | ); |
99 | 99 | } |
100 | 100 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | $this->type = $type; |
116 | - $this->setSourceUri(self::BASE_URI . '/stream?q=' . $sourceType); |
|
116 | + $this->setSourceUri(self::BASE_URI.'/stream?q='.$sourceType); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | { |
23 | 23 | if (!is_string($pattern)) { |
24 | 24 | throw new InvalidArgumentException( |
25 | - "Invalid type '" . gettype($pattern) . "' for argument 'pattern'." |
|
25 | + "Invalid type '".gettype($pattern)."' for argument 'pattern'." |
|
26 | 26 | ); |
27 | 27 | } |
28 | 28 | |
@@ -30,6 +30,6 @@ discard block |
||
30 | 30 | $patternReplaced = preg_quote($patternReplaced, '/'); |
31 | 31 | $patternReplaced = str_replace(["\nA\n", "\nQ\n"], ['.*', '.'], $patternReplaced); |
32 | 32 | |
33 | - return '/^' . $patternReplaced . '$/'; |
|
33 | + return '/^'.$patternReplaced.'$/'; |
|
34 | 34 | } |
35 | 35 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | { |
35 | 35 | if (!is_string($dataDirectory)) { |
36 | 36 | throw new InvalidArgumentException( |
37 | - "Invalid type '" . gettype($dataDirectory) . "' for argument 'dataDirectory'." |
|
37 | + "Invalid type '".gettype($dataDirectory)."' for argument 'dataDirectory'." |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | { |
35 | 35 | if (!is_string($dataVersionHash)) { |
36 | 36 | throw new InvalidArgumentException( |
37 | - "Invalid type '" . gettype($dataVersionHash) . "' for argument 'dataVersionHash'." |
|
37 | + "Invalid type '".gettype($dataVersionHash)."' for argument 'dataVersionHash'." |
|
38 | 38 | ); |
39 | 39 | } |
40 | 40 |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | if (!is_string($dataDirectory)) { |
88 | 88 | throw new InvalidArgumentException( |
89 | - "Invalid type '" . gettype($dataDirectory) . "' for argument 'dataDirectory'." |
|
89 | + "Invalid type '".gettype($dataDirectory)."' for argument 'dataDirectory'." |
|
90 | 90 | ); |
91 | 91 | } |
92 | 92 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | protected function getTemporaryFileName() |
117 | 117 | { |
118 | 118 | if ($this->temporaryFileName === null) { |
119 | - $this->temporaryFileName = $this->getDataDirectory() . DIRECTORY_SEPARATOR . |
|
120 | - 'browscap_' . microtime(true) . '.sqlite'; |
|
119 | + $this->temporaryFileName = $this->getDataDirectory().DIRECTORY_SEPARATOR. |
|
120 | + 'browscap_'.microtime(true).'.sqlite'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $this->temporaryFileName; |
@@ -190,28 +190,28 @@ discard block |
||
190 | 190 | |
191 | 191 | // Create tables |
192 | 192 | $adapter->exec( |
193 | - 'CREATE TABLE IF NOT EXISTS info (version_id INTEGER PRIMARY KEY ASC, release_time INTEGER NOT NULL, ' . |
|
193 | + 'CREATE TABLE IF NOT EXISTS info (version_id INTEGER PRIMARY KEY ASC, release_time INTEGER NOT NULL, '. |
|
194 | 194 | 'type_id INTEGER NOT NULL, data_hash TEXT NOT NULL)' |
195 | 195 | ); |
196 | 196 | $adapter->exec( |
197 | - 'CREATE TABLE IF NOT EXISTS browser (browser_id INTEGER PRIMARY KEY ASC, browser_parent_id INTEGER, ' . |
|
197 | + 'CREATE TABLE IF NOT EXISTS browser (browser_id INTEGER PRIMARY KEY ASC, browser_parent_id INTEGER, '. |
|
198 | 198 | 'browser_pattern TEXT NOT NULL)' |
199 | 199 | ); |
200 | 200 | $adapter->exec( |
201 | - 'CREATE TABLE IF NOT EXISTS search (browser_id INTEGER PRIMARY KEY ASC, ' . |
|
201 | + 'CREATE TABLE IF NOT EXISTS search (browser_id INTEGER PRIMARY KEY ASC, '. |
|
202 | 202 | 'browser_pattern_length INTEGER NOT NULL, browser_pattern TEXT NOT NULL)' |
203 | 203 | ); |
204 | 204 | |
205 | 205 | $adapter->exec( |
206 | - 'CREATE TABLE IF NOT EXISTS browser_property (browser_property_id INTEGER PRIMARY KEY ASC, ' . |
|
206 | + 'CREATE TABLE IF NOT EXISTS browser_property (browser_property_id INTEGER PRIMARY KEY ASC, '. |
|
207 | 207 | 'browser_id INTEGER NOT NULL, property_key_id INTEGER NOT NULL, property_value_id INTEGER NOT NULL)' |
208 | 208 | ); |
209 | 209 | $adapter->exec( |
210 | - 'CREATE TABLE IF NOT EXISTS browser_property_key (property_key_id INTEGER PRIMARY KEY ASC, ' . |
|
210 | + 'CREATE TABLE IF NOT EXISTS browser_property_key (property_key_id INTEGER PRIMARY KEY ASC, '. |
|
211 | 211 | 'property_key TEXT NOT NULL)' |
212 | 212 | ); |
213 | 213 | $adapter->exec( |
214 | - 'CREATE TABLE IF NOT EXISTS browser_property_value (property_value_id INTEGER PRIMARY KEY ASC, ' . |
|
214 | + 'CREATE TABLE IF NOT EXISTS browser_property_value (property_value_id INTEGER PRIMARY KEY ASC, '. |
|
215 | 215 | 'property_value TEXT NOT NULL)' |
216 | 216 | ); |
217 | 217 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | if (!is_string($tableName)) { |
240 | 240 | throw new InvalidArgumentException( |
241 | - "Invalid type '" . gettype($tableName) . "' for argument 'tableName'." |
|
241 | + "Invalid type '".gettype($tableName)."' for argument 'tableName'." |
|
242 | 242 | ); |
243 | 243 | } |
244 | 244 | |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | { |
359 | 359 | if (!is_string($pattern)) { |
360 | 360 | throw new InvalidArgumentException( |
361 | - "Invalid type '" . gettype($pattern) . "' for argument 'pattern'." |
|
361 | + "Invalid type '".gettype($pattern)."' for argument 'pattern'." |
|
362 | 362 | ); |
363 | 363 | } |
364 | 364 | if (!is_int($browserId)) { |
365 | 365 | throw new InvalidArgumentException( |
366 | - "Invalid type '" . gettype($browserId) . "' for argument 'browserId'." |
|
366 | + "Invalid type '".gettype($browserId)."' for argument 'browserId'." |
|
367 | 367 | ); |
368 | 368 | } |
369 | 369 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $parentId = $this->parentPatterns[$properties['Parent']]; |
387 | 387 | unset($properties['Parent']); |
388 | 388 | } else { |
389 | - throw new ParserRuntimeException("Parent '" . $properties['Parent'] . "' not found."); |
|
389 | + throw new ParserRuntimeException("Parent '".$properties['Parent']."' not found."); |
|
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | { |
446 | 446 | if (!is_string($pattern)) { |
447 | 447 | throw new InvalidArgumentException( |
448 | - "Invalid type '" . gettype($pattern) . "' for argument 'pattern'." |
|
448 | + "Invalid type '".gettype($pattern)."' for argument 'pattern'." |
|
449 | 449 | ); |
450 | 450 | } |
451 | 451 | |
@@ -509,15 +509,15 @@ discard block |
||
509 | 509 | // Do NOT use "CREATE TABLE ... AS" here, because this would automatically add an extra id column, |
510 | 510 | // which requires additional space |
511 | 511 | $adapter->exec( |
512 | - 'CREATE TABLE IF NOT EXISTS "search_' . $keywordValue . '" ' . |
|
513 | - '(browser_id INTEGER PRIMARY KEY ASC, browser_pattern_length INTEGER NOT NULL, ' . |
|
512 | + 'CREATE TABLE IF NOT EXISTS "search_'.$keywordValue.'" '. |
|
513 | + '(browser_id INTEGER PRIMARY KEY ASC, browser_pattern_length INTEGER NOT NULL, '. |
|
514 | 514 | 'browser_pattern TEXT NOT NULL)' |
515 | 515 | ); |
516 | 516 | /** @noinspection DisconnectedForeachInstructionInspection */ |
517 | 517 | $adapter->beginTransaction(); |
518 | 518 | $adapter->exec( |
519 | - 'INSERT INTO "search_' . $keywordValue . '" ' . |
|
520 | - 'SELECT browser_id, browser_pattern_length, browser_pattern ' . |
|
519 | + 'INSERT INTO "search_'.$keywordValue.'" '. |
|
520 | + 'SELECT browser_id, browser_pattern_length, browser_pattern '. |
|
521 | 521 | "FROM search WHERE browser_pattern GLOB '*$keywordValue*'" |
522 | 522 | ); |
523 | 523 | $adapter->exec("INSERT INTO keyword VALUES ($keywordId, '$keywordValue')"); |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $adapter->commitTransaction(); |
527 | 527 | |
528 | 528 | $adapter->exec( |
529 | - 'CREATE INDEX IF NOT EXISTS i_se' . $keywordId . '_brpale ON "search_' . $keywordValue . |
|
529 | + 'CREATE INDEX IF NOT EXISTS i_se'.$keywordId.'_brpale ON "search_'.$keywordValue. |
|
530 | 530 | '"(browser_pattern_length)' |
531 | 531 | ); |
532 | 532 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | protected function cleanUp() |
559 | 559 | { |
560 | 560 | $currentDatabaseFile = basename($this->getTemporaryFileName()); |
561 | - foreach (glob($this->getDataDirectory() . DIRECTORY_SEPARATOR . 'browscap_*.sqlite') as $file) { |
|
561 | + foreach (glob($this->getDataDirectory().DIRECTORY_SEPARATOR.'browscap_*.sqlite') as $file) { |
|
562 | 562 | if (basename($file) !== $currentDatabaseFile) { |
563 | 563 | @unlink($file); |
564 | 564 | } |
@@ -570,6 +570,6 @@ discard block |
||
570 | 570 | */ |
571 | 571 | protected function getLinkPath() |
572 | 572 | { |
573 | - return $this->getDataDirectory() . DIRECTORY_SEPARATOR . Parser::LINK_FILENAME; |
|
573 | + return $this->getDataDirectory().DIRECTORY_SEPARATOR.Parser::LINK_FILENAME; |
|
574 | 574 | } |
575 | 575 | } |
@@ -373,7 +373,7 @@ |
||
373 | 373 | /** |
374 | 374 | * @param array $properties |
375 | 375 | * |
376 | - * @return int|null |
|
376 | + * @return string|null |
|
377 | 377 | * @throws InvalidArgumentException |
378 | 378 | * @throws ParserRuntimeException |
379 | 379 | */ |