Start with snips content abstraction

This commit is contained in:
Tim
2023-04-15 13:20:07 +02:00
parent 980ea6af94
commit a405578f93
6 changed files with 53 additions and 11 deletions

View File

@ -4,6 +4,7 @@ namespace App\Service;
use App\Entity\Snip;
use App\Git\CustomGit;
use App\Service\SnipContent\SnipContentGit;
use Symfony\Bundle\SecurityBundle\Security;
class SnipServiceFactory
@ -16,7 +17,7 @@ class SnipServiceFactory
{
}
public function create(Snip $snip): SnipService
public function create(Snip $snip): SnipContentGit
{
$git = new CustomGit();
$repoPath = sprintf('%s/%s', $this->snipBasePath, $snip->getId());
@ -28,6 +29,6 @@ class SnipServiceFactory
} else {
$repo = $git->open($repoPath);
}
return new SnipService($repo, $this->security->getUser());
return new SnipContentGit($repo, $this->security->getUser());
}
}