Fix parameter type mismatch

This commit is contained in:
Bubka 2022-07-22 14:11:46 +02:00
parent 7d4add0159
commit 5aec206f99

View File

@ -33,9 +33,9 @@ class LogoService
* @param string $serviceName Name of the service to fetch a logo for * @param string $serviceName Name of the service to fetch a logo for
* @return string|null The icon filename or null if no logo has been found * @return string|null The icon filename or null if no logo has been found
*/ */
public function getIcon(string $serviceName) public function getIcon($serviceName)
{ {
$logoFilename = $this->getLogo($serviceName); $logoFilename = $this->getLogo(strval($serviceName));
if ($logoFilename) { if ($logoFilename) {
$newFilename = Str::random(40).'.svg'; $newFilename = Str::random(40).'.svg';
@ -51,9 +51,9 @@ class LogoService
* @param string $serviceName Name of the service to fetch a logo for * @param string $serviceName Name of the service to fetch a logo for
* @return string|null The logo filename or null if no logo has been found * @return string|null The logo filename or null if no logo has been found
*/ */
public function getLogo(string $serviceName) public function getLogo($serviceName)
{ {
$domain = $this->tfas->get($this->cleanDomain($serviceName)); $domain = $this->tfas->get($this->cleanDomain(strval($serviceName)));
$logoFilename = $domain.'.svg'; $logoFilename = $domain.'.svg';
if ($domain && !Storage::disk('logos')->exists($logoFilename)) { if ($domain && !Storage::disk('logos')->exists($logoFilename)) {
@ -140,9 +140,12 @@ class LogoService
/** /**
* Prepare and make some replacement to optimize logo fetching
* *
* @param string $str
* @return string Optimized domain name
*/ */
protected function cleanDomain($domain) : string protected function cleanDomain(string $domain) : string
{ {
return strtolower(str_replace(['+'], ['plus'], $domain)); return strtolower(str_replace(['+'], ['plus'], $domain));
} }