Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/Mooc/Videos/Application/Find/VideoFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,26 @@

namespace CodelyTv\Mooc\Videos\Application\Find;

use CodelyTv\Mooc\Videos\Domain\VideoFinder as DomainVideoFinder;
use CodelyTv\Mooc\Videos\Domain\VideoId;
use CodelyTv\Mooc\Videos\Domain\VideoRepository;
use CodelyTv\Mooc\Videos\Domain\Video;
use CodelyTv\Mooc\Videos\Domain\VideoNotFound;

final class VideoFinder
{
private DomainVideoFinder $finder;

public function __construct(VideoRepository $repository)
public function __construct(private VideoRepository $repository)
{
$this->finder = new DomainVideoFinder($repository);
}

public function __invoke(VideoId $id)
public function __invoke(VideoId $id): Video
{
return $this->finder->__invoke($id);
$video = $this->repository->search($id);

if (null === $video) {
throw new VideoNotFound($id);
}

return $video;
}
}
2 changes: 1 addition & 1 deletion src/Mooc/Videos/Application/Update/VideoTitleUpdater.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace CodelyTv\Mooc\Videos\Application\Update;

use CodelyTv\Mooc\Videos\Domain\VideoFinder;
use CodelyTv\Mooc\Videos\Application\Find\VideoFinder;
use CodelyTv\Mooc\Videos\Domain\VideoId;
use CodelyTv\Mooc\Videos\Domain\VideoRepository;
use CodelyTv\Mooc\Videos\Domain\VideoTitle;
Expand Down
23 changes: 0 additions & 23 deletions src/Mooc/Videos/Domain/VideoFinder.php

This file was deleted.