Skip to content

Commit

Permalink
Use injected Filesystem instance instead functions
Browse files Browse the repository at this point in the history
  • Loading branch information
SenseException committed Jul 19, 2023
1 parent 0e404bd commit a73ef84
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/WebsiteBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
use Symfony\Component\Filesystem\Filesystem;

use function chdir;
use function file_exists;
use function file_put_contents;
use function getcwd;
use function glob;
use function in_array;
use function is_dir;
use function sprintf;
use function symlink;
use function unlink;

class WebsiteBuilder
{
Expand Down Expand Up @@ -189,12 +186,12 @@ private function createVersionAlias(string $dir, ProjectVersion $version, string

chdir($dir);

if (file_exists($alias)) {
unlink($alias);
if ($this->filesystem->exists($alias)) {
$this->filesystem->remove($alias);
}

if (file_exists($version->getSlug())) {
symlink($version->getSlug(), $alias);
if ($this->filesystem->exists($version->getSlug())) {
$this->filesystem->symlink($version->getSlug(), $alias);
}

if ($cwd === false) {
Expand Down

0 comments on commit a73ef84

Please sign in to comment.