@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if (empty(trim($title))) { |
23 | 23 | return null; |
24 | 24 | } |
25 | - $title = str_replace(['–','—','\\'],['-','-','/'], $title); // replace em dash with hyphen |
|
25 | + $title = str_replace(['–', '—', '\\'], ['-', '-', '/'], $title); // replace em dash with hyphen |
|
26 | 26 | |
27 | 27 | $seoSegments = $this->extractSEOSegments($title); |
28 | 28 | // No SEO segmentation found |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | } |
32 | 32 | |
33 | 33 | // remove seo segments containing same words as the website domain name |
34 | - $seoSegmentsFiltered = array_values(array_filter($seoSegments, function ($segment) use ($prettyDomainName) { |
|
34 | + $seoSegmentsFiltered = array_values(array_filter($seoSegments, function($segment) use ($prettyDomainName) { |
|
35 | 35 | // strip string after last dot in prettyDomainName : blabla.com => blabla |
36 | 36 | $domainMain = preg_replace('/\.[^.]*$/', '', $prettyDomainName); |
37 | 37 | // strip string if only 2 chars after dot : like in 'blabla.co.uk' |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | // rebuild bestTitle but keep only the first 2 SEO segments |
56 | - return trim($seoSegmentsFiltered[0]) . ' - ' . trim($seoSegmentsFiltered[1]); |
|
56 | + return trim($seoSegmentsFiltered[0]).' - '.trim($seoSegmentsFiltered[1]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | private function extractSEOSegments(string $title): array |