2022-07-08 14:53:04 +00:00
|
|
|
<?php
|
|
|
|
|
2024-03-22 14:34:13 +00:00
|
|
|
namespace App\Http\Integrations\Lastfm\Concerns;
|
2022-07-08 14:53:04 +00:00
|
|
|
|
|
|
|
trait FormatsLastFmText
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Correctly format a value returned by Last.fm.
|
|
|
|
*/
|
|
|
|
private static function formatLastFmText(?string $value): string
|
|
|
|
{
|
2022-10-13 23:11:14 +00:00
|
|
|
$artifacts = [
|
|
|
|
'Read more on Last.fm.',
|
|
|
|
'Read more on Last.fm',
|
|
|
|
'User-contributed text is available under the Creative Commons By-SA License; additional terms may apply.',
|
|
|
|
];
|
|
|
|
|
2022-07-08 14:53:04 +00:00
|
|
|
return $value
|
2022-10-13 23:11:14 +00:00
|
|
|
? trim(str_replace($artifacts, '', nl2br(strip_tags(html_entity_decode($value)))))
|
2022-07-08 14:53:04 +00:00
|
|
|
: '';
|
|
|
|
}
|
|
|
|
}
|