File tree Expand file tree Collapse file tree 5 files changed +45
-12
lines changed Expand file tree Collapse file tree 5 files changed +45
-12
lines changed Original file line number Diff line number Diff line change 22
33namespace Native \Laravel ;
44
5- use Illuminate \Support \Traits \Conditionable ;
6- use Illuminate \Support \Traits \Macroable ;
75use Native \Laravel \Client \Client ;
8- use Native \Laravel \Facades \Window ;
96
107class Alert
118{
129 protected ?string $ type ;
10+
1311 protected ?string $ title ;
12+
1413 protected ?string $ detail ;
14+
1515 protected ?array $ buttons ;
16+
1617 protected ?int $ defaultId ;
18+
1719 protected ?int $ cancelId ;
1820
19- final public function __construct (protected Client $ client )
20- {
21- }
21+ final public function __construct (protected Client $ client ) {}
2222
2323 public static function new ()
2424 {
@@ -76,7 +76,7 @@ public function show(string $message): int
7676 'detail ' => $ this ->detail ,
7777 'buttons ' => $ this ->buttons ,
7878 'defaultId ' => $ this ->defaultId ,
79- 'cancelId ' => $ this ->cancelId
79+ 'cancelId ' => $ this ->cancelId ,
8080 ]);
8181
8282 return (int ) $ response ->json ('result ' );
Original file line number Diff line number Diff line change 88use Illuminate \Support \Collection ;
99use Illuminate \Support \Facades \File ;
1010use Illuminate \Support \Facades \Process ;
11+ use Native \Laravel \Support \Environment ;
1112
1213use function Laravel \Prompts \error ;
1314use function Laravel \Prompts \info ;
@@ -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 ' );
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public function register(): void
1414 Event::listen ('* ' , function (string $ eventName , array $ data ) {
1515 $ event = $ data [0 ] ?? (object ) null ;
1616
17- if (! is_object ($ event )) {
17+ if (! is_object ($ event )) {
1818 return ;
1919 }
2020
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Native \Laravel \Support ;
4+
5+ class Environment
6+ {
7+ public static function isWindows (): bool
8+ {
9+ return PHP_OS_FAMILY === 'Windows ' ;
10+ }
11+
12+ public static function isLinux (): bool
13+ {
14+ return PHP_OS_FAMILY === 'Linux ' ;
15+ }
16+
17+ public static function isMac (): bool
18+ {
19+ return PHP_OS_FAMILY === 'Darwin ' ;
20+ }
21+
22+ public static function isUnknown (): bool
23+ {
24+ return PHP_OS_FAMILY === 'Unknown ' ;
25+ }
26+
27+ public static function isUnixLike (): bool
28+ {
29+ return static ::isLinux () || static ::isMac ();
30+ }
31+ }
Original file line number Diff line number Diff line change 44
55use Native \Laravel \Client \Client ;
66use Native \Laravel \DataObjects \Printer ;
7+ use Native \Laravel \Support \Environment ;
78use Native \Laravel \Support \Timezones ;
89
910class 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 ' ));
You can’t perform that action at this time.
0 commit comments