Skip to content

Commit bc0aa03

Browse files
TomatoPanagithub-actions[bot]
authored andcommitted
Fix code styling
1 parent 4e4bd84 commit bc0aa03

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/Recorders/Servers.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static function detectMemoryUsing(?callable $callback): void
7272
public function record(SharedBeat $event): void
7373
{
7474
$this->throttle(15, $event, function ($event) {
75-
$server = $this->config->get('pulse.recorders.' . self::class . '.server_name');
75+
$server = $this->config->get('pulse.recorders.'.self::class.'.server_name');
7676
$slug = Str::slug($server);
7777

7878
['total' => $memoryTotal, 'used' => $memoryUsed] = $this->memory();
@@ -85,9 +85,9 @@ public function record(SharedBeat $event): void
8585
'cpu' => $cpu,
8686
'memory_used' => $memoryUsed,
8787
'memory_total' => $memoryTotal,
88-
'storage' => collect($this->config->get('pulse.recorders.' . self::class . '.directories')) // @phpstan-ignore argument.templateType, argument.templateType
89-
->filter(fn(string $directory) => ($this->pulse->rescue(fn() => disk_total_space($directory)) ?? false) !== false)
90-
->map(fn(string $directory) => [
88+
'storage' => collect($this->config->get('pulse.recorders.'.self::class.'.directories')) // @phpstan-ignore argument.templateType, argument.templateType
89+
->filter(fn (string $directory) => ($this->pulse->rescue(fn () => disk_total_space($directory)) ?? false) !== false)
90+
->map(fn (string $directory) => [
9191
'directory' => $directory,
9292
'total' => $total = intval(round(disk_total_space($directory) / 1024 / 1024)), // MB
9393
'used' => intval(round($total - (disk_free_space($directory) / 1024 / 1024))), // MB
@@ -109,9 +109,9 @@ protected function cpu(): int
109109
return match (PHP_OS_FAMILY) {
110110
'Darwin' => (int) shell_exec("top -l 1 | grep -E \"^CPU\" | tail -1 | awk '{ print $3 + $5 }'"),
111111
'Linux' => (int) shell_exec("top -bn1 | grep -E '^(%Cpu|CPU)' | awk '{ print $2 + $4 }'"),
112-
'Windows' => (int) trim(shell_exec("wmic cpu get loadpercentage | more +1")),
112+
'Windows' => (int) trim(shell_exec('wmic cpu get loadpercentage | more +1')),
113113
'BSD' => (int) shell_exec("top -b -d 2| grep 'CPU: ' | tail -1 | awk '{print$10}' | grep -Eo '[0-9]+\.[0-9]+' | awk '{ print 100 - $1 }'"),
114-
default => throw new RuntimeException('The pulse:check command does not currently support ' . PHP_OS_FAMILY),
114+
default => throw new RuntimeException('The pulse:check command does not currently support '.PHP_OS_FAMILY),
115115
};
116116
}
117117

@@ -129,17 +129,17 @@ protected function memory(): array
129129
$memoryTotal = match (PHP_OS_FAMILY) {
130130
'Darwin' => intval(shell_exec("sysctl hw.memsize | grep -Eo '[0-9]+'") / 1024 / 1024),
131131
'Linux' => intval(shell_exec("cat /proc/meminfo | grep MemTotal | grep -E -o '[0-9]+'") / 1024),
132-
'Windows' => intval(((int) trim(shell_exec("wmic ComputerSystem get TotalPhysicalMemory | more +1"))) / 1024 / 1024),
132+
'Windows' => intval(((int) trim(shell_exec('wmic ComputerSystem get TotalPhysicalMemory | more +1'))) / 1024 / 1024),
133133
'BSD' => intval(shell_exec("sysctl hw.physmem | grep -Eo '[0-9]+'") / 1024 / 1024),
134-
default => throw new RuntimeException('The pulse:check command does not currently support ' . PHP_OS_FAMILY),
134+
default => throw new RuntimeException('The pulse:check command does not currently support '.PHP_OS_FAMILY),
135135
};
136136

137137
$memoryUsed = match (PHP_OS_FAMILY) {
138-
'Darwin' => $memoryTotal - intval(intval(shell_exec("vm_stat | grep 'Pages free' | grep -Eo '[0-9]+'")) * intval(shell_exec("pagesize")) / 1024 / 1024), // MB
138+
'Darwin' => $memoryTotal - intval(intval(shell_exec("vm_stat | grep 'Pages free' | grep -Eo '[0-9]+'")) * intval(shell_exec('pagesize')) / 1024 / 1024), // MB
139139
'Linux' => $memoryTotal - intval(shell_exec("cat /proc/meminfo | grep MemAvailable | grep -E -o '[0-9]+'") / 1024), // MB
140-
'Windows' => $memoryTotal - intval(((int) trim(shell_exec("wmic OS get FreePhysicalMemory | more +1"))) / 1024), // MB
141-
'BSD' => intval(intval(shell_exec("( sysctl vm.stats.vm.v_cache_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_inactive_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_active_count | grep -Eo '[0-9]+' ) | awk '{s+=$1} END {print s}'")) * intval(shell_exec("pagesize")) / 1024 / 1024), // MB
142-
default => throw new RuntimeException('The pulse:check command does not currently support ' . PHP_OS_FAMILY),
140+
'Windows' => $memoryTotal - intval(((int) trim(shell_exec('wmic OS get FreePhysicalMemory | more +1'))) / 1024), // MB
141+
'BSD' => intval(intval(shell_exec("( sysctl vm.stats.vm.v_cache_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_inactive_count | grep -Eo '[0-9]+' ; sysctl vm.stats.vm.v_active_count | grep -Eo '[0-9]+' ) | awk '{s+=$1} END {print s}'")) * intval(shell_exec('pagesize')) / 1024 / 1024), // MB
142+
default => throw new RuntimeException('The pulse:check command does not currently support '.PHP_OS_FAMILY),
143143
};
144144

145145
return [

0 commit comments

Comments
 (0)