summaryrefslogtreecommitdiff
path: root/app/Source.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Source.php')
-rw-r--r--app/Source.php34
1 files changed, 27 insertions, 7 deletions
diff --git a/app/Source.php b/app/Source.php
index 4273e882c9..a100090a53 100644
--- a/app/Source.php
+++ b/app/Source.php
@@ -1,6 +1,4 @@
<?php
-namespace Fisharebest\Webtrees;
-
/**
* webtrees: online genealogy
* Copyright (C) 2015 webtrees development team
@@ -15,15 +13,22 @@ namespace Fisharebest\Webtrees;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace Fisharebest\Webtrees;
/**
- * Class Source - A GEDCOM source (SOUR) object
+ * A GEDCOM source (SOUR) object.
*/
class Source extends GedcomRecord {
const RECORD_TYPE = 'SOUR';
const URL_PREFIX = 'source.php?sid=';
- /** {@inheritdoc} */
+ /**
+ * Each object type may have its own special rules, and re-implement this function.
+ *
+ * @param int $access_level
+ *
+ * @return bool
+ */
protected function canShowByType($access_level) {
// Hide sources if they are attached to private repositories ...
preg_match_all('/\n1 REPO @(.+)@/', $this->gedcom, $matches);
@@ -38,12 +43,25 @@ class Source extends GedcomRecord {
return parent::canShowByType($access_level);
}
- /** {@inheritdoc} */
+ /**
+ * Generate a private version of this record
+ *
+ * @param int $access_level
+ *
+ * @return string
+ */
protected function createPrivateGedcomRecord($access_level) {
return '0 @' . $this->xref . "@ SOUR\n1 TITL " . I18N::translate('Private');
}
- /** {@inheritdoc} */
+ /**
+ * Fetch data from the database
+ *
+ * @param string $xref
+ * @param int $tree_id
+ *
+ * @return null|string
+ */
protected static function fetchGedcomRecord($xref, $tree_id) {
return Database::prepare(
"SELECT s_gedcom FROM `##sources` WHERE s_id = :xref AND s_file = :tree_id"
@@ -53,7 +71,9 @@ class Source extends GedcomRecord {
))->fetchOne();
}
- /** {@inheritdoc} */
+ /**
+ * Extract names from the GEDCOM record.
+ */
public function extractNames() {
parent::extractNamesFromFacts(1, 'TITL', $this->getFacts('TITL'));
}