app/Http/Controllers/BranchesController.php
protected function allAncestors(Individual $individual): array
    {
        /** @var Individual[] $ancestors */
        $ancestors = [
            1 => $individual,
        ];

        do {
            $sosa = key($ancestors);

            $family = $ancestors[$sosa]->primaryChildFamily();

            if ($family !== null) {
                if ($family->husband() !== null) {
                    $ancestors[$sosa * 2] = $family->husband();
                }
                if ($family->wife() !== null) {
                    $ancestors[$sosa * 2 + 1] = $family->wife();
                }
            }
        } while (next($ancestors));

        return $ancestors;
    }
protected function allAncestors(Individual $individual): array
    {
        /** @var Individual[] $ancestors */
        $ancestors = [
            1 => $individual,
        ];

        do {
            $sosa = key($ancestors);

            $family = $ancestors[$sosa]->primaryChildFamily();

            if ($family !== null) {
                if ($family->husband() !== null) {
                    $ancestors[$sosa * 2] = $family->husband();
                }
                if ($family->wife() !== null) {
                    $ancestors[$sosa * 2 + 1] = $family->wife();
                }
            }
        } while (next($ancestors));

        return $ancestors;
    }
protected function allAncestors ( Individual $ individual ) : array { /** @var Individual[] $ancestors */ $ ancestors = [ 1 => $ individual , ] ; do { $ sosa = key ( $ ancestors ) ; $ family = $ ancestors [ $ sosa ] -> primaryChildFamily ( ) ; if ( $ family !== null ) { if ( $ family -> husband ( ) !== null ) { $ ancestors [ $ sosa * 2 ] = $ family -> husband ( ) ; } if ( $ family -> wife ( ) !== null ) { $ ancestors [ $ sosa * 2 + 1 ] = $ family -> wife ( ) ; } } } while ( next ( $ ancestors ) ) ; return $ ancestors ; }
Find all ancestors of an individual, indexed by the Sosa-Stradonitz number.

@param Individual $individual

@return Individual[]
Find all ancestors of an individual indexed by the Sosa - Stradonitz number .