Skip to content

Commit d3029f9

Browse files
committed
Fixed some PHPStan recommendations.
Updated dependencies.
1 parent 697da28 commit d3029f9

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/agentzero.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ protected static function getTokens(string $ua, array $single, array $ignore) :
188188
* @return agentzero|false An agentzero object containing the parsed values of the input UA, or false if it could not be parsed
189189
*/
190190
public static function parse(string $ua) : agentzero|false {
191-
$ua = \trim(\preg_replace('/\s{2,}/', ' ', $ua), ' "\'');
192-
if (($config = config::get()) === null) {
191+
if (($ua = \preg_replace('/\s{2,}/', ' ', $ua)) === null) {
193192

194-
} elseif (($tokens = self::getTokens($ua, $config['single'], $config['ignore'])) !== false) {
193+
} elseif (($config = config::get()) === null) {
194+
195+
} elseif (($tokens = self::getTokens(\trim($ua, ' "\''), $config['single'], $config['ignore'])) !== false) {
195196

196197
// extract UA info
197198
$browser = new \stdClass();

src/mappings/crawlers.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public static function getApp(string $value, array $data = []) : array {
3737
'duckduckgo-favicons-bot' => 'search',
3838
'coccocbot-image' => 'search',
3939
'coccocbot-web' => 'search',
40-
'applebot' => 'ai',
4140
'yandexbot' => 'search',
4241
'mj12bot' => 'search',
4342
'mail.ru_bot' => 'search',
@@ -182,7 +181,7 @@ public static function getApp(string $value, array $data = []) : array {
182181
return [];
183182
}
184183

185-
protected static function normaliseAppname(string $name) {
184+
protected static function normaliseAppname(string $name) : string {
186185
$find = ['_', '-', '+', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];
187186
$replace = [' ', ' ', '', ' A', ' B', ' C', ' D', ' E', ' F', ' G', ' H', ' I', ' J', ' K', ' L', ' M', ' N', ' O', ' P', ' Q', ' R', ' S', ' T', ' U', ' V', ' W', ' X', ' Y', ' Z'];
188187
$name = \trim(\str_replace($find, $replace, $name));

0 commit comments

Comments
 (0)