Skip to content

Commit

Permalink
Remove FileSystemContract.size(), which was never used as an interfac…
Browse files Browse the repository at this point in the history
…e method
  • Loading branch information
danon committed May 31, 2022
1 parent 9226575 commit 6c2f999
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 19 deletions.
8 changes: 2 additions & 6 deletions includes/Support/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use ErrorException;
use Exception;
use function filesize;
use function is_file;

class FileSystem implements FileSystemContract
Expand Down Expand Up @@ -54,7 +55,7 @@ public function sharedGet($path)
try {
if (flock($handle, LOCK_SH)) {
clearstatcache(true, $path);
$contents = fread($handle, $this->size($path) ?: 1);
$contents = fread($handle, filesize($path) ?: 1);
flock($handle, LOCK_UN);
}
} finally {
Expand All @@ -69,11 +70,6 @@ public function isDirectory($path)
return is_dir($path);
}

public function size($path)
{
return filesize($path);
}

public function append($file, $text)
{
if ($this->exists($file) && strlen($this->get($file))) {
Expand Down
8 changes: 0 additions & 8 deletions includes/Support/FileSystemContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ public function sharedGet($path);
*/
public function isDirectory($path);

/**
* Get the file size of a given file.
*
* @param string $path
* @return int
*/
public function size($path);

/**
* Add text to the end of the file
*
Expand Down
5 changes: 0 additions & 5 deletions tests/Psr4/MemoryFileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ public function isDirectory($path)
return $this->exists($formattedPath) && $this->fileSystem[$formattedPath]["type"] === "d";
}

public function size($path)
{
return $this->exists($path) ? 1 : 0;
}

public function append($file, $text)
{
if ($this->exists($file) && strlen($this->get($file))) {
Expand Down

0 comments on commit 6c2f999

Please sign in to comment.