Replace switch statement with array mapping
Some checks failed
timw4mail/HummingBirdAnimeClient/develop There was a failure building this commit
Some checks failed
timw4mail/HummingBirdAnimeClient/develop There was a failure building this commit
This commit is contained in:
parent
fccc794528
commit
f243dd4583
@ -66,74 +66,62 @@ final class Kitsu {
|
||||
*/
|
||||
protected static function getServiceMetaData(string $hostname = NULL): array
|
||||
{
|
||||
switch($hostname)
|
||||
{
|
||||
case 'www.amazon.com':
|
||||
return [
|
||||
$serviceMap = [
|
||||
'www.amazon.com' => [
|
||||
'name' => 'Amazon Prime',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/amazon.svg',
|
||||
];
|
||||
|
||||
case 'www.crunchyroll.com':
|
||||
return [
|
||||
],
|
||||
'www.crunchyroll.com' => [
|
||||
'name' => 'Crunchyroll',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/crunchyroll.svg',
|
||||
];
|
||||
|
||||
case 'www.daisuki.net':
|
||||
return [
|
||||
],
|
||||
'www.daisuki.net' => [
|
||||
'name' => 'Daisuki',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/daisuki.svg'
|
||||
];
|
||||
|
||||
case 'www.funimation.com':
|
||||
return [
|
||||
],
|
||||
'wwww.funimation.com' => [
|
||||
'name' => 'Funimation',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/funimation.svg',
|
||||
];
|
||||
|
||||
case 'www.hidive.com':
|
||||
return [
|
||||
],
|
||||
'www.hidive.com' => [
|
||||
'name' => 'Hidive',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/hidive.svg',
|
||||
];
|
||||
|
||||
case 'www.hulu.com':
|
||||
return [
|
||||
],
|
||||
'www.hulu.com' => [
|
||||
'name' => 'Hulu',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/hulu.svg',
|
||||
];
|
||||
|
||||
case 'tubitv.com':
|
||||
return [
|
||||
],
|
||||
'tubitv.com' => [
|
||||
'name' => 'TubiTV',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/tubitv.svg',
|
||||
];
|
||||
|
||||
case 'www.viewster.com':
|
||||
return [
|
||||
],
|
||||
'www.viewster.com' => [
|
||||
'name' => 'Viewster',
|
||||
'link' => TRUE,
|
||||
'image' => 'streaming-logos/viewster.svg'
|
||||
],
|
||||
];
|
||||
|
||||
if (array_key_exists($hostname, $serviceMap))
|
||||
{
|
||||
return $serviceMap[$hostname];
|
||||
}
|
||||
|
||||
// Default to Netflix, because the API links are broken,
|
||||
// and there's no other real identifier for Netflix
|
||||
default:
|
||||
return [
|
||||
'name' => 'Netflix',
|
||||
'link' => FALSE,
|
||||
'image' => 'streaming-logos/netflix.svg',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorganize streaming links
|
||||
|
Loading…
Reference in New Issue
Block a user