From 6a91ff1188f447711d7f1f887abd188d567e284b Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 12 Jul 2024 11:08:37 +0200 Subject: [PATCH] docs --- README.md | 8 ++++++++ src/Measurements.php | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 82fa7a5..a63801c 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,14 @@ Also, you can combine them (very handy for blog posts and tweets): vendor/bin/lines measure src --short --json ``` +
+ +Are you looking for top 10 longest files? + +```bash +vendor/bin/lines measure src --longest +``` + ## The Measured Items For the text output, you'll get data like these: diff --git a/src/Measurements.php b/src/Measurements.php index 5bd0b3b..556f8b0 100644 --- a/src/Measurements.php +++ b/src/Measurements.php @@ -58,7 +58,7 @@ public function addFile(string $filename): void $this->directoryNames[] = dirname($filename); $relativeFilePath = str_replace(getcwd() . '/', '', $filename); - $this->filesToSize[$relativeFilePath] = substr_count(file_get_contents($filename), "\n") + 1; + $this->filesToSize[$relativeFilePath] = substr_count((string) file_get_contents($filename), "\n") + 1; ++$this->fileCount; }