Skip to content

Commit

Permalink
fixed lint issues, added getCpuCount function to the dummy os
Browse files Browse the repository at this point in the history
Signed-off-by: Malex14 <39774812+Malex14@users.noreply.github.com>
  • Loading branch information
Malex14 authored and kesselb committed Dec 12, 2024
1 parent a07e0ee commit 89683e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/OperatingSystems/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,8 @@ public function getDiskInfo(): array {
public function getThermalZones(): array {
return [];
}

public function getCpuCount(): int {
return 1;
}
}
3 changes: 2 additions & 1 deletion lib/OperatingSystems/FreeBSD.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public function getCpuCount(): int {

try {
$numCpu = intval($this->executeCommand('sysctl -n hw.ncpu')); //TODO: this should be tested if it actually works on FreeBSD
} catch (RuntimeException) {}
} catch (RuntimeException) {
}

return $numCpu;
}
Expand Down
6 changes: 3 additions & 3 deletions lib/OperatingSystems/Linux.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ public function getCpuName(): string {
return $data;
}

public function getCpuCount(): int
{
public function getCpuCount(): int {
$numCpu = 1; // this should be a save default

try {
$numCpu = intval($this->executeCommand('nproc --all'));
} catch (RuntimeException) {}
} catch (RuntimeException) {
}

return $numCpu;
}
Expand Down

0 comments on commit 89683e4

Please sign in to comment.