Refactoring (indentation) the code of Entity/Person.php

This commit is contained in:
Marc Ducobu 2015-08-24 15:53:18 +02:00
parent f967285e34
commit 471bace86d

View File

@ -183,6 +183,8 @@ class Person implements HasCenterInterface {
} }
/** /**
* Get the accompanying periods of a give person with the
* chronological order.
* *
* @return AccompanyingPeriod[] * @return AccompanyingPeriod[]
*/ */
@ -191,32 +193,30 @@ class Person implements HasCenterInterface {
//order by date : //order by date :
usort($periods, function($a, $b) { usort($periods, function($a, $b) {
$dateA = $a->getOpeningDate();
$dateB = $b->getOpeningDate();
$dateA = $a->getOpeningDate(); if ($dateA == $dateB) {
$dateB = $b->getOpeningDate(); $dateEA = $a->getClosingDate();
$dateEB = $b->getClosingDate();
if ($dateA == $dateB) { if ($dateEA == $dateEB) {
$dateEA = $a->getClosingDate(); return 0;
$dateEB = $b->getClosingDate(); }
if ($dateEA == $dateEB) { if ($dateEA < $dateEB) {
return 0; return -1;
} } else {
return +1;
if ($dateEA < $dateEB) { }
return -1; }
} else {
return +1;
}
}
if ($dateA < $dateB) {
return -1 ;
} else {
return 1;
}
});
if ($dateA < $dateB) {
return -1 ;
} else {
return 1;
}
});
return $periods; return $periods;
} }