. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; /** * Did the individual marry within the last year. */ class CensusColumnMarriedWithinYear extends AbstractCensusColumn implements CensusColumnInterface { /** * Generate the likely value of this census column, based on available information. * * @param Individual $individual * @param Individual|null $head * * @return string */ public function generate(Individual $individual, Individual $head = null) { foreach ($individual->getSpouseFamilies() as $family) { foreach ($family->getFacts('MARR') as $fact) { if ($fact->getDate()->julianDay() + 365 >= $this->date()->julianDay()) { return 'Y'; } } } return ''; } }