Skip to content

Commit ef181bd

Browse files
author
Pete Bishop
committed
Abstract all usages of PHP_OS_FAMILY to Environment class
1 parent 3aa385e commit ef181bd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Commands/DebugCommand.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Support\Facades\File;
1010
use Illuminate\Support\Facades\Process;
1111

12+
use Native\Laravel\Support\Environment;
1213
use function Laravel\Prompts\error;
1314
use function Laravel\Prompts\info;
1415
use function Laravel\Prompts\intro;
@@ -53,7 +54,7 @@ private function processEnvironment(): static
5354
{
5455
$locationCommand = 'which';
5556

56-
if (PHP_OS_FAMILY === 'Windows') {
57+
if (Environment::isWindows()) {
5758
$locationCommand = 'where';
5859
}
5960

@@ -154,9 +155,9 @@ private function outputToClipboard(): void
154155
$json = json_encode($this->debugInfo->toArray(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
155156

156157
// Copy json to clipboard
157-
if (PHP_OS_FAMILY === 'Windows') {
158+
if (Environment::isWindows()) {
158159
Process::run('echo '.escapeshellarg($json).' | clip');
159-
} elseif (PHP_OS_FAMILY === 'Linux') {
160+
} elseif (Environment::isLinux()) {
160161
Process::run('echo '.escapeshellarg($json).' | xclip -selection clipboard');
161162
} else {
162163
Process::run('echo '.escapeshellarg($json).' | pbcopy');

src/System.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Native\Laravel\Client\Client;
66
use Native\Laravel\DataObjects\Printer;
7+
use Native\Laravel\Support\Environment;
78
use Native\Laravel\Support\Timezones;
89

910
class System
@@ -79,7 +80,7 @@ public function timezone(): string
7980
{
8081
$timezones = new Timezones;
8182

82-
if (PHP_OS_FAMILY === 'Windows') {
83+
if (Environment::isWindows()) {
8384
$timezone = $timezones->translateFromWindowsString(exec('tzutil /g'));
8485
} else {
8586
$timezone = $timezones->translateFromAbbreviatedString(exec('date +%Z'));

0 commit comments

Comments
 (0)