2022-07-08 14:53:04 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Values;
|
|
|
|
|
|
|
|
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
|
|
|
: '';
|
|
|
|
}
|
|
|
|
}
|