| Total Complexity | 4 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 4 | class Factory |
||
| 5 | { |
||
| 6 | /** |
||
| 7 | * Configs. |
||
| 8 | */ |
||
| 9 | protected array $config; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Create Embed factory and set providers from config. |
||
| 13 | */ |
||
| 14 | public function __construct(?array $config = null) |
||
| 15 | { |
||
| 16 | if (is_null($config)) { |
||
| 17 | $config = require(__DIR__ . '/../resources/config.php'); |
||
| 18 | } |
||
| 19 | $this->config = $config; |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Create a new OEmbed instance. |
||
| 24 | */ |
||
| 25 | public function make(): OEmbed |
||
| 26 | { |
||
| 27 | return new OEmbed($this->config); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Helper method to quickly get embed data from OEmbed instance. |
||
| 32 | */ |
||
| 33 | public function get(string $url, array $options = []): ?Embed |
||
| 36 | } |
||
| 37 | } |
||
| 38 |