Skip to content

Commit

Permalink
Merge pull request #12 from cesargb/exception_notfile
Browse files Browse the repository at this point in the history
Throw exception if source is not a file
  • Loading branch information
cesargb authored Jan 25, 2022
2 parents d9a72a0 + b7db43b commit abfb735
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Rotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private function sucessfull(string $filenameSource, ?string $filenameRotated): v
*/
private function canRotate(string $filename): bool
{
if (!is_file($filename)) {
if (!file_exists($filename)) {
return false;
}

Expand Down Expand Up @@ -209,7 +209,7 @@ private function initProcessorFile(string $filename): void
*/
private function fileIsValid(string $filename): bool
{
return is_writable($filename);
return is_file($filename) && is_writable($filename);
}

/**
Expand Down

0 comments on commit abfb735

Please sign in to comment.