NicoSeigaResolver::class, '~nijie\.info/view(_popup)?\.php~' => NijieResolver::class, '~komiflo\.com(/#!)?/comics/(\\d+)~' => KomifloResolver::class, '~www\.melonbooks\.co\.jp/detail/detail\.php~' => MelonbooksResolver::class, '~ec\.toranoana\.jp/tora_r/ec/item/.*~' => ToranoanaResolver::class, '~iwara\.tv/videos/.*~' => IwaraResolver::class, '/.*/' => OGPResolver::class ]; public function resolve(string $url): Metadata { foreach ($this->rules as $pattern => $class) { if (preg_match($pattern, $url) === 1) { $resolver = new $class; return $resolver->resolve($url); } } throw new \UnexpectedValueException('URL not matched.'); } }