Skip to content

Commit

Permalink
Merge pull request #5 from denisyukphp/5.0.x
Browse files Browse the repository at this point in the history
  • Loading branch information
denisyukphp authored Nov 19, 2024
2 parents bf7d0eb + 9e058e3 commit 9d52ad0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function __construct()
public function addTmpFile(TmpFileInterface $tmpFile): void
{
if ($this->hasTmpFile($tmpFile)) {
throw new \InvalidArgumentException(sprintf('Temp file "%s" has been already added.', $tmpFile->getFilename()));
throw new \InvalidArgumentException(\sprintf('Temp file "%s" has been already added.', $tmpFile->getFilename()));
}

$this->tmpFiles->attach($tmpFile);
Expand All @@ -32,7 +32,7 @@ public function hasTmpFile(TmpFileInterface $tmpFile): bool
public function removeTmpFile(TmpFileInterface $tmpFile): void
{
if (!$this->hasTmpFile($tmpFile)) {
throw new \InvalidArgumentException(sprintf('Temp file "%s" hasn\'t been added yet.', $tmpFile->getFilename()));
throw new \InvalidArgumentException(\sprintf('Temp file "%s" hasn\'t been added yet.', $tmpFile->getFilename()));
}

$this->tmpFiles->detach($tmpFile);
Expand Down
6 changes: 3 additions & 3 deletions src/TmpFileManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function load(TmpFileInterface ...$tmpFiles): void

foreach ($tmpFiles as $tmpFile) {
if (!$this->filesystem->existsTmpFile($tmpFile)) {
throw new \InvalidArgumentException(sprintf('Temp file "%s" doesn\'t exist.', $tmpFile->getFilename()));
throw new \InvalidArgumentException(\sprintf('Temp file "%s" doesn\'t exist.', $tmpFile->getFilename()));
}

$this->container->addTmpFile($tmpFile);
Expand All @@ -85,11 +85,11 @@ public function isolate(callable $callback): void
public function remove(TmpFileInterface $tmpFile): void
{
if (!$this->filesystem->existsTmpFile($tmpFile)) {
throw new \InvalidArgumentException(sprintf('Temp file "%s" has been already removed.', $tmpFile->getFilename()));
throw new \InvalidArgumentException(\sprintf('Temp file "%s" has been already removed.', $tmpFile->getFilename()));
}

if (!$this->container->hasTmpFile($tmpFile)) {
throw new \InvalidArgumentException(sprintf('Temp file "%s" wasn\'t create through temp file manager.', $tmpFile->getFilename()));
throw new \InvalidArgumentException(\sprintf('Temp file "%s" wasn\'t create through temp file manager.', $tmpFile->getFilename()));
}

$this->eventDispatcher->dispatch(new TmpFilePreRemove($tmpFile));
Expand Down

0 comments on commit 9d52ad0

Please sign in to comment.