diff options
Diffstat (limited to '2024/PHP/day_04/Input.php')
| -rw-r--r-- | 2024/PHP/day_04/Input.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/2024/PHP/day_04/Input.php b/2024/PHP/day_04/Input.php index f7e03c1..60a16a0 100644 --- a/2024/PHP/day_04/Input.php +++ b/2024/PHP/day_04/Input.php @@ -4,22 +4,22 @@ declare(strict_types=1); class Input { - public string $contents; + public string $contents; - public function __construct(private string $fileName) - { - $contents = file_get_contents($this->fileName, use_include_path: true); - $this->contents = $contents === false ? "" : $contents; - } + public function __construct(private string $fileName) + { + $contents = file_get_contents($this->fileName, use_include_path: true); + $this->contents = $contents === false ? "" : $contents; + } - public function toGrid(): Grid - { - $lines = explode("\n", $this->contents); - $gridArray = array_map( - callback: fn(string $line): array => str_split(trim($line)), - array: $lines - ); + public function toGrid(): Grid + { + $lines = explode("\n", $this->contents); + $gridArray = array_map( + callback: fn (string $line): array => str_split(trim($line)), + array: $lines + ); - return new Grid($gridArray); - } + return new Grid($gridArray); + } } |
