app/Report/ReportParserGenerate.php
private function gedcomStartHandler(array $attrs): void
    {
        if ($this->process_gedcoms > 0) {
            $this->process_gedcoms++;

            return;
        }

        $tag       = $attrs['id'];
        $tag       = str_replace('@fact', $this->fact, $tag);
        $tags      = explode(':', $tag);
        $newgedrec = '';
        if (count($tags) < 2) {
            $tmp       = GedcomRecord::getInstance($attrs['id'], $this->tree);
            $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
        }
        if (empty($newgedrec)) {
            $tgedrec   = $this->gedrec;
            $newgedrec = '';
            foreach ($tags as $tag) {
                if (preg_match('/\$(.+)/', $tag, $match)) {
                    if (isset($this->vars[$match[1]]['gedcom'])) {
                        $newgedrec = $this->vars[$match[1]]['gedcom'];
                    } else {
                        $tmp       = GedcomRecord::getInstance($match[1], $this->tree);
                        $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
                    }
                } else {
                    if (preg_match('/@(.+)/', $tag, $match)) {
                        $gmatch = [];
                        if (preg_match("/\d $match[1] @([^@]+)@/", $tgedrec, $gmatch)) {
                            $tmp       = GedcomRecord::getInstance($gmatch[1], $this->tree);
                            $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
                            $tgedrec   = $newgedrec;
                        } else {
                            $newgedrec = '';
                            break;
                        }
                    } else {
                        $temp      = explode(' ', trim($tgedrec));
                        $level     = 1 + (int) $temp[0];
                        $newgedrec = Functions::getSubRecord($level, "$level $tag", $tgedrec);
                        $tgedrec   = $newgedrec;
                    }
                }
            }
        }
        if (!empty($newgedrec)) {
            $this->gedrec_stack[] = [$this->gedrec, $this->fact, $this->desc];
            $this->gedrec         = $newgedrec;
            if (preg_match("/(\d+) (_?[A-Z0-9]+) (.*)/", $this->gedrec, $match)) {
                $this->fact = $match[2];
                $this->desc = trim($match[3]);
            }
        } else {
            $this->process_gedcoms++;
        }
    }
private function gedcomStartHandler(array $attrs): void
    {
        if ($this->process_gedcoms > 0) {
            $this->process_gedcoms++;

            return;
        }

        $tag       = $attrs['id'];
        $tag       = str_replace('@fact', $this->fact, $tag);
        $tags      = explode(':', $tag);
        $newgedrec = '';
        if (count($tags) < 2) {
            $tmp       = GedcomRecord::getInstance($attrs['id'], $this->tree);
            $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
        }
        if (empty($newgedrec)) {
            $tgedrec   = $this->gedrec;
            $newgedrec = '';
            foreach ($tags as $tag) {
                if (preg_match('/\$(.+)/', $tag, $match)) {
                    if (isset($this->vars[$match[1]]['gedcom'])) {
                        $newgedrec = $this->vars[$match[1]]['gedcom'];
                    } else {
                        $tmp       = GedcomRecord::getInstance($match[1], $this->tree);
                        $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
                    }
                } else {
                    if (preg_match('/@(.+)/', $tag, $match)) {
                        $gmatch = [];
                        if (preg_match("/\d $match[1] @([^@]+)@/", $tgedrec, $gmatch)) {
                            $tmp       = GedcomRecord::getInstance($gmatch[1], $this->tree);
                            $newgedrec = $tmp ? $tmp->privatizeGedcom(Auth::accessLevel($this->tree)) : '';
                            $tgedrec   = $newgedrec;
                        } else {
                            $newgedrec = '';
                            break;
                        }
                    } else {
                        $temp      = explode(' ', trim($tgedrec));
                        $level     = 1 + (int) $temp[0];
                        $newgedrec = Functions::getSubRecord($level, "$level $tag", $tgedrec);
                        $tgedrec   = $newgedrec;
                    }
                }
            }
        }
        if (!empty($newgedrec)) {
            $this->gedrec_stack[] = [$this->gedrec, $this->fact, $this->desc];
            $this->gedrec         = $newgedrec;
            if (preg_match("/(\d+) (_?[A-Z0-9]+) (.*)/", $this->gedrec, $match)) {
                $this->fact = $match[2];
                $this->desc = trim($match[3]);
            }
        } else {
            $this->process_gedcoms++;
        }
    }
private function gedcomStartHandler ( array $ attrs ) : void { if ( $ this -> process_gedcoms > 0 ) { $ this -> process_gedcoms ++ ; return ; } $ tag = $ attrs [ 'id' ] ; $ tag = str_replace ( '@fact' , $ this -> fact , $ tag ) ; $ tags = explode ( ':' , $ tag ) ; $ newgedrec = '' ; if ( count ( $ tags ) < 2 ) { $ tmp = GedcomRecord :: getInstance ( $ attrs [ 'id' ] , $ this -> tree ) ; $ newgedrec = $ tmp ? $ tmp -> privatizeGedcom ( Auth :: accessLevel ( $ this -> tree ) ) : '' ; } if ( empty ( $ newgedrec ) ) { $ tgedrec = $ this -> gedrec ; $ newgedrec = '' ; foreach ( $ tags as $ tag ) { if ( preg_match ( '/\$(.+)/' , $ tag , $ match ) ) { if ( isset ( $ this -> vars [ $ match [ 1 ] ] [ 'gedcom' ] ) ) { $ newgedrec = $ this -> vars [ $ match [ 1 ] ] [ 'gedcom' ] ; } else { $ tmp = GedcomRecord :: getInstance ( $ match [ 1 ] , $ this -> tree ) ; $ newgedrec = $ tmp ? $ tmp -> privatizeGedcom ( Auth :: accessLevel ( $ this -> tree ) ) : '' ; } } else { if ( preg_match ( '/@(.+)/' , $ tag , $ match ) ) { $ gmatch = [ ] ; if ( preg_match ( "/\d $match[1] @([^@]+)@/" , $ tgedrec , $ gmatch ) ) { $ tmp = GedcomRecord :: getInstance ( $ gmatch [ 1 ] , $ this -> tree ) ; $ newgedrec = $ tmp ? $ tmp -> privatizeGedcom ( Auth :: accessLevel ( $ this -> tree ) ) : '' ; $ tgedrec = $ newgedrec ; } else { $ newgedrec = '' ; break ; } } else { $ temp = explode ( ' ' , trim ( $ tgedrec ) ) ; $ level = 1 + ( int ) $ temp [ 0 ] ; $ newgedrec = Functions :: getSubRecord ( $ level , "$level $tag" , $ tgedrec ) ; $ tgedrec = $ newgedrec ; } } } } if ( ! empty ( $ newgedrec ) ) { $ this -> gedrec_stack [ ] = [ $ this -> gedrec , $ this -> fact , $ this -> desc ] ; $ this -> gedrec = $ newgedrec ; if ( preg_match ( "/(\d+) (_?[A-Z0-9]+) (.*)/" , $ this -> gedrec , $ match ) ) { $ this -> fact = $ match [ 2 ] ; $ this -> desc = trim ( $ match [ 3 ] ) ; } } else { $ this -> process_gedcoms ++ ; } }
Called at the start of an element.

@param string[] $attrs an array of key value pairs for the attributes

@return void
Called at the start of an element .