Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Jul 22, 2023
1 parent 5314fb2 commit 42b57d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"ext-zip": "*",
"composer-runtime-api": "^2.2",
"composer/semver": "^1.5 || ^3.0",
"illuminate/support": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0",
"symfony/console": "^4.3.4 || ^5.0 || ^6.0",
"symfony/polyfill-ctype": "^1.9",
"symfony/process": "^4.3.4 || ^5.0 || ^6.0"
Expand Down
3 changes: 2 additions & 1 deletion src/OperatingSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Orchestra\DuskUpdater;

use Illuminate\Support\Str;
use InvalidArgumentException;

class OperatingSystem
Expand Down Expand Up @@ -142,7 +143,7 @@ public static function onWindows(): bool
return PHP_OS_FAMILY === 'Windows';
}

return PHP_OS === 'WINNT' || mb_strpos(php_uname(), 'Microsoft') !== false;
return PHP_OS === 'WINNT' || Str::contains(php_uname(), 'Microsoft');
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace Orchestra\DuskUpdater;

use Illuminate\Support\Str;

/**
* Rename exported ChromeDriver binary filename.
*/
function rename_chromedriver_binary(string $binary, string $operatingSystem): string
{
return mb_strpos($binary, DIRECTORY_SEPARATOR) > 0
? array_reverse(explode(DIRECTORY_SEPARATOR, str_replace('chromedriver', 'chromedriver-'.$operatingSystem, $binary), 2))[0]
return Str::contains($binary, DIRECTORY_SEPARATOR)
? Str::after(str_replace('chromedriver', 'chromedriver-'.$operatingSystem, $binary), DIRECTORY_SEPARATOR)
: str_replace('chromedriver', 'chromedriver-'.$operatingSystem, $binary);
}

Expand Down

0 comments on commit 42b57d8

Please sign in to comment.