-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVideoDrivers.php
More file actions
36 lines (27 loc) · 937 Bytes
/
VideoDrivers.php
File metadata and controls
36 lines (27 loc) · 937 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Vanilo\Video;
use Illuminate\Support\Facades\App;
use Konekt\Extend\Concerns\HasRegistry;
use Konekt\Extend\Concerns\RequiresClassOrInterface;
use Konekt\Extend\Contracts\Registry;
use Vanilo\Video\Contracts\VideoDriver;
use Vanilo\Video\Exceptions\UnknownVideoDriverException;
final class VideoDrivers implements Registry
{
use HasRegistry;
use RequiresClassOrInterface;
private static string $requiredInterface = VideoDriver::class;
public static function register(string $id, string $class)
{
return self::add($id, $class);
}
public static function make(string $id, array $parameters = []): VideoDriver
{
$class = self::getClassOf($id);
if (null === $class) {
throw new UnknownVideoDriverException("No video driver is registered with the id `$id`.");
}
return App::make($class, $parameters);
}
}