diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2020-05-26 09:29:13 +0100 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2020-05-26 09:44:25 +0100 |
| commit | 9ecabc6aa3095099058228aa70b9a0363599048d (patch) | |
| tree | 21a1eec2746ba6edb3d3a187ee31e13b28bab38c /app/Fact.php | |
| parent | 43e7e97ace939b5136597bb51e4493fec0c1f88a (diff) | |
| download | webtrees-9ecabc6aa3095099058228aa70b9a0363599048d.tar.gz webtrees-9ecabc6aa3095099058228aa70b9a0363599048d.tar.bz2 webtrees-9ecabc6aa3095099058228aa70b9a0363599048d.zip | |
Make Fact objects immutable. Remove setTag()
Diffstat (limited to 'app/Fact.php')
| -rw-r--r-- | app/Fact.php | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/app/Fact.php b/app/Fact.php index f2a7d8be9d..27042eab3f 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -364,7 +364,7 @@ class Fact } // Members cannot edit RESN, CHAN and locked records - return Auth::isEditor($this->record->tree()) && strpos($this->gedcom, "\n2 RESN locked") === false && $this->getTag() !== 'RESN' && $this->getTag() !== 'CHAN'; + return Auth::isEditor($this->record->tree()) && strpos($this->gedcom, "\n2 RESN locked") === false && $this->tag() !== 'RESN' && $this->tag() !== 'CHAN'; } /** @@ -422,17 +422,31 @@ class Fact * * @return string */ - public function getTag(): string + public function tag(): string { return $this->tag; } /** + * What is the tag (type) of this fact, such as BIRT, MARR or DEAT. + * + * @return string + * + * @deprecated since 2.0.5. Will be removed in 2.1.0 + */ + public function getTag(): string + { + return $this->tag(); + } + + /** * Used to convert a real fact (e.g. BIRT) into a close-relative’s fact (e.g. _BIRT_CHIL) * * @param string $tag * * @return void + * + * @deprecated since 2.0.5. Will be removed in 2.1.0 */ public function setTag($tag): void { @@ -590,7 +604,7 @@ class Fact // Fact date $date = $this->date(); if ($date->isOK()) { - if ($this->record() instanceof Individual && in_array($this->getTag(), Gedcom::BIRTH_EVENTS, true) && $this->record()->tree()->getPreference('SHOW_PARENTS_AGE')) { + if ($this->record() instanceof Individual && in_array($this->tag(), Gedcom::BIRTH_EVENTS, true) && $this->record()->tree()->getPreference('SHOW_PARENTS_AGE')) { $attributes[] = $date->display() . FunctionsPrint::formatParentsAges($this->record(), $date); } else { $attributes[] = $date->display(); @@ -602,7 +616,7 @@ class Fact } } - $class = 'fact_' . $this->getTag(); + $class = 'fact_' . $this->tag(); if ($this->isPendingAddition()) { $class .= ' wt-new'; } elseif ($this->isPendingDeletion()) { @@ -667,8 +681,8 @@ class Fact return $a->sortOrder - $b->sortOrder; } - $atag = $a->getTag(); - $btag = $b->getTag(); + $atag = $a->tag(); + $btag = $b->tag(); // Events not in the above list get mapped onto one that is. if (!array_key_exists($atag, $factsort)) { |
