From 8cd59c150ac42c7b325b7e3cbf9418027d8ea5fb Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Thu, 19 Dec 2024 20:40:53 +1100 Subject: [PATCH] trim --- src/SDK/Resource/Detectors/Host.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/SDK/Resource/Detectors/Host.php b/src/SDK/Resource/Detectors/Host.php index decf44af5..87a719754 100644 --- a/src/SDK/Resource/Detectors/Host.php +++ b/src/SDK/Resource/Detectors/Host.php @@ -55,17 +55,12 @@ private function readFile(string $file): string|false set_error_handler(static fn () => true); try { - if (is_file($file) && is_readable($file)) { - $contents = file_get_contents($file); - if ($contents !== false) { - return $contents; - } - } + $contents = file_get_contents($file); + + return is_string($contents) ? trim($contents) : false; } finally { restore_error_handler(); } - - return false; } private function getLinuxId(): ?string