Skip to content
Snippets Groups Projects
Commit f9e3431d authored by Laurent's avatar Laurent
Browse files

Port indexation::setArticleDebut to Linse

parent 02c8ebd5
Branches master
No related merge requests found
Pipeline #6137 failed with stage
......@@ -599,4 +599,27 @@ class Linse {
}
else return '';
}
public function putArticleToFront($title) {
if(substr($title,-1) !=")")
return $title;
foreach($this->exclu as $article) {
$compare = "(" . trim($article) . ")";
$lg = strlen($compare);
if(strtoUpper(substr($title,-$lg)) == $compare) {
$deb = substr($title,- $lg);
$deb = str_replace("(","",$article);
$deb = str_replace(")","",$article);
if (substr($deb,-1)!="'")
$deb .= " ";
$new = $deb . trim(substr($title, 0, (strlen($title) - $lg)));
return $new;
}
}
return $title;
}
}
\ No newline at end of file
......@@ -72,6 +72,12 @@ class LinseTest extends PHPUnit_Framework_TestCase {
}
/** @test */
public function putArticleToFrontForPianoLeShouldReturnLePiano() {
$this->assertEquals('LE Piano', $this->_model->putArticleToFront('Piano (le)'));
}
public function titlesAndAlpha() {
return [
[ 'Norvege, Islande', 'NORVEGE ISLANDE' ],
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment