diff options
Diffstat (limited to 'app/Census/CensusColumnChildrenLiving.php')
| -rw-r--r-- | app/Census/CensusColumnChildrenLiving.php | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/app/Census/CensusColumnChildrenLiving.php b/app/Census/CensusColumnChildrenLiving.php index 1b7eea6a0d..7f65c2d33d 100644 --- a/app/Census/CensusColumnChildrenLiving.php +++ b/app/Census/CensusColumnChildrenLiving.php @@ -22,34 +22,36 @@ use Fisharebest\Webtrees\Individual; /** * The number of children who are still living. */ -class CensusColumnChildrenLiving extends AbstractCensusColumn implements CensusColumnInterface { - /** - * Generate the likely value of this census column, based on available information. - * - * @param Individual $individual - * @param Individual $head - * - * @return string - */ - public function generate(Individual $individual, Individual $head = null) { - if ($individual->getSex() !== 'F') { - return ''; - } +class CensusColumnChildrenLiving extends AbstractCensusColumn implements CensusColumnInterface +{ + /** + * Generate the likely value of this census column, based on available information. + * + * @param Individual $individual + * @param Individual $head + * + * @return string + */ + public function generate(Individual $individual, Individual $head = null) + { + if ($individual->getSex() !== 'F') { + return ''; + } - $count = 0; - foreach ($individual->getSpouseFamilies() as $family) { - foreach ($family->getChildren() as $child) { - if ( - $child->getBirthDate()->isOK() && - Date::compare($child->getBirthDate(), $this->date()) < 0 && - $child->getBirthDate() != $child->getDeathDate() && - (!$child->getDeathDate()->isOK() || Date::compare($child->getDeathDate(), $this->date()) > 0) - ) { - $count++; - } - } - } + $count = 0; + foreach ($individual->getSpouseFamilies() as $family) { + foreach ($family->getChildren() as $child) { + if ( + $child->getBirthDate()->isOK() && + Date::compare($child->getBirthDate(), $this->date()) < 0 && + $child->getBirthDate() != $child->getDeathDate() && + (!$child->getDeathDate()->isOK() || Date::compare($child->getDeathDate(), $this->date()) > 0) + ) { + $count++; + } + } + } - return (string) $count; - } + return (string)$count; + } } |
