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; }