Files
nuhodds_fi4/app/Console/Commands/Services/Tasks/Helper/ExplodeElement.php
T
2026-01-15 16:14:10 +01:00

54 lines
1.1 KiB
PHP

<?php
namespace App\Console\Commands\Services\Tasks\Helper;
class ExplodeElement
{
public static function grap($str)
{
$tmp = str_replace(',', ' ', $str);
// $tmp = str_replace('-', ' ', $tmp);
$tmp = str_replace('/', ' ', $tmp);
$tmp = preg_replace('"\([^\)]*\)"', '', $tmp);
$tmp = preg_replace('/[^a-zA-Z0-9 ] /', '', $tmp);
$tmp = str_replace(' ', ' ', $tmp);
$elements = explode(' ', $tmp);
$_return = [];
foreach ($elements as $value) {
if (\strlen($value) > 2) {
$_return[] = $value;
}
}
usort($_return, function ($a, $b) {
return strlen($b) <=> strlen($a);
});
$remove = [
'fc',
'city',
'new',
'real',
'united',
'dinamo',
'town',
'club',
'union',
'sport',
'sports',
'basket',
'hapoel',
'maccabi',
'east'];
return array_diff($_return, $remove);
}
}