1 | <?php namespace Arcanedev\EmbedVideo; |
||
13 | class ParserManager extends Manager implements ParserManagerContract |
||
14 | { |
||
15 | /* ----------------------------------------------------------------- |
||
16 | | Properties |
||
17 | | ----------------------------------------------------------------- |
||
18 | */ |
||
19 | /** |
||
20 | * Parser's patterns. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $patterns = []; |
||
25 | |||
26 | /* ----------------------------------------------------------------- |
||
27 | | Getters & Setters |
||
28 | | ----------------------------------------------------------------- |
||
29 | */ |
||
30 | /** |
||
31 | * Get the default driver name. |
||
32 | * |
||
33 | * @return string |
||
34 | */ |
||
35 | public function getDefaultDriver() |
||
39 | |||
40 | /* ----------------------------------------------------------------- |
||
41 | | Constructor |
||
42 | | ----------------------------------------------------------------- |
||
43 | */ |
||
44 | /** |
||
45 | * Create a new manager instance. |
||
46 | * |
||
47 | * @param \Illuminate\Foundation\Application $app |
||
48 | */ |
||
49 | 87 | public function __construct($app) |
|
55 | |||
56 | /* ----------------------------------------------------------------- |
||
57 | | Main Methods |
||
58 | | ----------------------------------------------------------------- |
||
59 | */ |
||
60 | /** |
||
61 | * Get a video parser implementation. |
||
62 | * |
||
63 | * @param string $parser |
||
64 | * |
||
65 | * @return \Arcanedev\EmbedVideo\Contracts\Parser |
||
66 | */ |
||
67 | 81 | public function parser($parser = null) |
|
71 | |||
72 | /** |
||
73 | * Guess the parser based on the given url. |
||
74 | * |
||
75 | * @param string $url |
||
76 | * |
||
77 | * @return \Arcanedev\EmbedVideo\Contracts\Parser|null |
||
78 | */ |
||
79 | 6 | public function guess($url) |
|
90 | |||
91 | /* ----------------------------------------------------------------- |
||
92 | | Other Methods |
||
93 | | ----------------------------------------------------------------- |
||
94 | */ |
||
95 | /** |
||
96 | * Get the config repository. |
||
97 | * |
||
98 | * @return \Illuminate\Contracts\Config\Repository |
||
99 | */ |
||
100 | 87 | protected function config() |
|
104 | |||
105 | /** |
||
106 | * Get a config value. |
||
107 | * |
||
108 | * @param string $key |
||
109 | * @param mixed|null $default |
||
110 | * |
||
111 | * @return mixed |
||
112 | */ |
||
113 | 87 | protected function getConfig($key, $default = null) |
|
117 | |||
118 | /** |
||
119 | * Register the parsers. |
||
120 | */ |
||
121 | 87 | private function registerParsers() |
|
127 | |||
128 | /** |
||
129 | * Register the parser. |
||
130 | * |
||
131 | * @param string $driver |
||
132 | * @param array $configs |
||
133 | */ |
||
134 | protected function registerParser($driver, array $configs) |
||
144 | |||
145 | /** |
||
146 | * Register patterns. |
||
147 | * |
||
148 | * @param string $driver |
||
149 | * @param array $configs |
||
150 | */ |
||
151 | 87 | protected function registerPatterns($driver, array $configs) |
|
155 | } |
||
156 |