54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\Services\Tasks\Helper;
|
|
|
|
class ExplodeString
|
|
{
|
|
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) > 3) {
|
|
$_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);
|
|
}
|
|
}
|