Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
donatj committed Apr 7, 2020
1 parent 4464ab1 commit 5d0b52d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/UserAgentParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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) ) {
Expand Down

0 comments on commit 5d0b52d

Please sign in to comment.