. */ namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Individual; /** * Marital status. */ class CensusColumnConditionUs 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) { $family = $this->spouseFamily($individual); if ($family === null || count($family->getFacts('_NMR')) > 0) { return 'S'; // unmarried } elseif (count($family->getFacts('DIV')) > 0) { return 'D'; // divorced } else { return 'M'; // married } } }