mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Fix ::canBeReOpened
.
1. Fix call to `::getOpenParticipationContainsPerson` instead of `::getParticipationsContainsPerson`. 2. Use early returns to reduce cyclomatic complexity. 3. Avoid storing variable that are used only once.
This commit is contained in:
parent
a6e0b16032
commit
484259c8ab
@ -435,15 +435,16 @@ class AccompanyingPeriod
|
||||
return false;
|
||||
}
|
||||
|
||||
$participation = $this->getParticipationsContainsPerson($person);
|
||||
if (!null === $participation)
|
||||
$participation = $this->getOpenParticipationContainsPerson($person);
|
||||
|
||||
if (null === $participation)
|
||||
{
|
||||
$person = $participation->getPerson();
|
||||
$periods = $person->getAccompanyingPeriodsOrdered();
|
||||
return end($periods) === $this;
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
$periods = $participation->getPerson()->getAccompanyingPeriodsOrdered();
|
||||
|
||||
return end($periods) === $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user