From 5d0b52dc64c273c29ba87b99081d26aead5b64d9 Mon Sep 17 00:00:00 2001 From: Jesse Donat Date: Tue, 7 Apr 2020 10:21:57 -0500 Subject: [PATCH] Cleanup --- src/UserAgentParser.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/UserAgentParser.php b/src/UserAgentParser.php index 17ccf9a..6416a38 100644 --- a/src/UserAgentParser.php +++ b/src/UserAgentParser.php @@ -85,7 +85,7 @@ function parse_user_agent( $u_agent = null ) { $lowerBrowser = array_map('strtolower', $result['browser']); - $find = function ( $search, &$key, &$value = null ) use ( $lowerBrowser ) { + $find = function ( $search, &$key = null, &$value = null ) use ( $lowerBrowser ) { $search = (array)$search; foreach( $search as $val ) { @@ -142,15 +142,15 @@ function parse_user_agent( $u_agent = null ) { } elseif( $find('UCBrowser', $key) ) { $browser = 'UC Browser'; $version = $result['version'][$key]; - } elseif( $find('YaBrowser', $key, $browser) ) { + } elseif( $find('YaBrowser', $key) ) { $browser = 'Yandex'; $version = $result['version'][$key]; - } elseif( $find(array( 'Edge', 'Edg' ), $key, $browser) ) { + } elseif( $find(array( 'Edge', 'Edg' ), $key) ) { $browser = 'Edge'; $version = $result['version'][$key]; } elseif( $find(array( 'IEMobile', 'Midori', 'Vivaldi', 'OculusBrowser', 'SamsungBrowser', 'Valve Steam Tenfoot', 'Chrome', 'HeadlessChrome' ), $key, $browser) ) { $version = $result['version'][$key]; - } elseif( $rv_result && $find('Trident', $key) ) { + } elseif( $rv_result && $find('Trident') ) { $browser = 'MSIE'; $version = $rv_result; } elseif( $find('CriOS', $key) ) {