summaryrefslogtreecommitdiff
path: root/app/Statistics
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2020-05-12 00:38:22 +0100
committerGreg Roach <greg@subaqua.co.uk>2020-05-12 14:19:35 +0100
commita091ac74647eab281b25090b737835eeea14ae10 (patch)
tree5e968be23c54e70f67812b1cca78c7e1e17aa95d /app/Statistics
parentbb03c9f048b83092098d5e46c2ab323ae7e2b314 (diff)
downloadwebtrees-a091ac74647eab281b25090b737835eeea14ae10.tar.gz
webtrees-a091ac74647eab281b25090b737835eeea14ae10.tar.bz2
webtrees-a091ac74647eab281b25090b737835eeea14ae10.zip
Update code to use new Factory objects
Diffstat (limited to 'app/Statistics')
-rw-r--r--app/Statistics/Google/ChartFamilyLargest.php6
-rw-r--r--app/Statistics/Repository/EventRepository.php8
-rw-r--r--app/Statistics/Repository/FamilyDatesRepository.php8
-rw-r--r--app/Statistics/Repository/FamilyRepository.php40
-rw-r--r--app/Statistics/Repository/GedcomRepository.php8
-rw-r--r--app/Statistics/Repository/IndividualRepository.php7
-rw-r--r--app/Statistics/Repository/UserRepository.php3
7 files changed, 40 insertions, 40 deletions
diff --git a/app/Statistics/Google/ChartFamilyLargest.php b/app/Statistics/Google/ChartFamilyLargest.php
index db109bbdb0..84103017b8 100644
--- a/app/Statistics/Google/ChartFamilyLargest.php
+++ b/app/Statistics/Google/ChartFamilyLargest.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2020 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -19,7 +19,7 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Statistics\Google;
-use Fisharebest\Webtrees\Family;
+use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Module\ModuleThemeInterface;
use Fisharebest\Webtrees\Statistics\Service\ColorService;
@@ -107,7 +107,7 @@ class ChartFamilyLargest
];
foreach ($this->queryRecords($total) as $record) {
- $family = Family::getInstance($record->id, $this->tree);
+ $family = Factory::family()->make($record->id, $this->tree);
if ($family && $family->canShow()) {
$data[] = [
diff --git a/app/Statistics/Repository/EventRepository.php b/app/Statistics/Repository/EventRepository.php
index f279133a4d..128e4e2517 100644
--- a/app/Statistics/Repository/EventRepository.php
+++ b/app/Statistics/Repository/EventRepository.php
@@ -21,9 +21,9 @@ namespace Fisharebest\Webtrees\Statistics\Repository;
use Fisharebest\Webtrees\Date;
use Fisharebest\Webtrees\Fact;
+use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\Gedcom;
-use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\GedcomTag;
use Fisharebest\Webtrees\Header;
use Fisharebest\Webtrees\I18N;
@@ -247,7 +247,7 @@ class EventRepository implements EventRepositoryInterface
$result = I18N::translate('This information is not available.');
if ($row) {
- $record = GedcomRecord::getInstance($row->id, $this->tree);
+ $record = Factory::gedcomRecord()->make($row->id, $this->tree);
if ($record && $record->canShow()) {
$result = $record->formatList();
@@ -365,7 +365,7 @@ class EventRepository implements EventRepositoryInterface
$row = $this->eventQuery($direction);
if ($row) {
- $record = GedcomRecord::getInstance($row->id, $this->tree);
+ $record = Factory::gedcomRecord()->make($row->id, $this->tree);
if ($record) {
return '<a href="' . e($record->url()) . '">' . $record->fullName() . '</a>';
@@ -403,7 +403,7 @@ class EventRepository implements EventRepositoryInterface
$row = $this->eventQuery($direction);
if ($row) {
- $record = GedcomRecord::getInstance($row->id, $this->tree);
+ $record = Factory::gedcomRecord()->make($row->id, $this->tree);
$fact = null;
if ($record) {
diff --git a/app/Statistics/Repository/FamilyDatesRepository.php b/app/Statistics/Repository/FamilyDatesRepository.php
index 66f2336c9e..f2324d0263 100644
--- a/app/Statistics/Repository/FamilyDatesRepository.php
+++ b/app/Statistics/Repository/FamilyDatesRepository.php
@@ -21,8 +21,8 @@ namespace Fisharebest\Webtrees\Statistics\Repository;
use Fisharebest\Webtrees\Date;
use Fisharebest\Webtrees\Fact;
+use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
-use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Statistics\Repository\Interfaces\FamilyDatesRepositoryInterface;
use Fisharebest\Webtrees\Tree;
@@ -102,7 +102,7 @@ class FamilyDatesRepository implements FamilyDatesRepositoryInterface
$result = I18N::translate('This information is not available.');
if ($row) {
- $record = GedcomRecord::getInstance($row->id, $this->tree);
+ $record = Factory::gedcomRecord()->make($row->id, $this->tree);
if ($record && $record->canShow()) {
$result = $record->formatList();
@@ -279,7 +279,7 @@ class FamilyDatesRepository implements FamilyDatesRepositoryInterface
$row = $this->eventQuery($type, $operation);
if ($row) {
- $record = GedcomRecord::getInstance($row->id, $this->tree);
+ $record = Factory::gedcomRecord()->make($row->id, $this->tree);
if ($record) {
return '<a href="' . e($record->url()) . '">' . $record->fullName() . '</a>';
@@ -366,7 +366,7 @@ class FamilyDatesRepository implements FamilyDatesRepositoryInterface
$row = $this->eventQuery($type, $operation);
if ($row) {
- $record = GedcomRecord::getInstance($row->id, $this->tree);
+ $record = Factory::gedcomRecord()->make($row->id, $this->tree);
$fact = null;
if ($record) {
diff --git a/app/Statistics/Repository/FamilyRepository.php b/app/Statistics/Repository/FamilyRepository.php
index 21f8c9b416..ca01d7be6d 100644
--- a/app/Statistics/Repository/FamilyRepository.php
+++ b/app/Statistics/Repository/FamilyRepository.php
@@ -2,7 +2,7 @@
/**
* webtrees: online genealogy
- * Copyright (C) 2019 webtrees development team
+ * Copyright (C) 2020 webtrees development team
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@@ -20,10 +20,10 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Statistics\Repository;
use Exception;
+use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\GedcomRecord;
use Fisharebest\Webtrees\I18N;
-use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Statistics\Google\ChartChildren;
use Fisharebest\Webtrees\Statistics\Google\ChartDivorce;
use Fisharebest\Webtrees\Statistics\Google\ChartFamilyLargest;
@@ -78,7 +78,7 @@ class FamilyRepository
}
/** @var Family $family */
- $family = Family::rowMapper($this->tree)($row);
+ $family = Factory::family()->mapper($this->tree)($row);
if (!$family->canShow()) {
return I18N::translate('This information is private and cannot be shown.');
@@ -159,7 +159,7 @@ class FamilyRepository
->select(['families.*'])
->limit($total)
->get()
- ->map(Family::rowMapper($this->tree))
+ ->map(Factory::family()->mapper($this->tree))
->filter(GedcomRecord::accessFilter())
->map(static function (Family $family): array {
$count = 0;
@@ -241,7 +241,7 @@ class FamilyRepository
->where('f_file', '=', $this->tree->id())
->where('f_numchil', '=', 0)
->get()
- ->map(Family::rowMapper($this->tree))
+ ->map(Factory::family()->mapper($this->tree))
->filter(GedcomRecord::accessFilter());
$top10 = [];
@@ -364,9 +364,9 @@ class FamilyRepository
$rows = $this->ageBetweenSiblingsQuery($total);
foreach ($rows as $fam) {
- $family = Family::getInstance($fam->family, $this->tree);
- $child1 = Individual::getInstance($fam->ch1, $this->tree);
- $child2 = Individual::getInstance($fam->ch2, $this->tree);
+ $family = Factory::family()->make($fam->family, $this->tree);
+ $child1 = Factory::individual()->make($fam->ch1, $this->tree);
+ $child2 = Factory::individual()->make($fam->ch2, $this->tree);
if ($child1->canShow() && $child2->canShow()) {
// ! Single array (no list)
@@ -398,9 +398,9 @@ class FamilyRepository
$dist = [];
foreach ($rows as $fam) {
- $family = Family::getInstance($fam->family, $this->tree);
- $child1 = Individual::getInstance($fam->ch1, $this->tree);
- $child2 = Individual::getInstance($fam->ch2, $this->tree);
+ $family = Factory::family()->make($fam->family, $this->tree);
+ $child1 = Factory::individual()->make($fam->ch1, $this->tree);
+ $child2 = Factory::individual()->make($fam->ch2, $this->tree);
$age = $this->calculateAge((int) $fam->age);
@@ -459,9 +459,9 @@ class FamilyRepository
$rows = $this->ageBetweenSiblingsQuery($total);
foreach ($rows as $fam) {
- $family = Family::getInstance($fam->family, $this->tree);
- $child1 = Individual::getInstance($fam->ch1, $this->tree);
- $child2 = Individual::getInstance($fam->ch2, $this->tree);
+ $family = Factory::family()->make($fam->family, $this->tree);
+ $child1 = Factory::individual()->make($fam->ch1, $this->tree);
+ $child2 = Factory::individual()->make($fam->ch2, $this->tree);
if ($child1->canShow() && $child2->canShow()) {
$return = '<a href="' . e($child2->url()) . '">' . $child2->fullName() . '</a> ';
@@ -622,7 +622,7 @@ class FamilyRepository
->orderBy('f_numchil', 'DESC')
->limit($total)
->get()
- ->map(Family::rowMapper($this->tree))
+ ->map(Factory::family()->mapper($this->tree))
->filter(GedcomRecord::accessFilter())
->map(static function (Family $family): array {
return [
@@ -838,7 +838,7 @@ class FamilyRepository
return '';
}
- $person = Individual::getInstance($row->id, $this->tree);
+ $person = Factory::individual()->make($row->id, $this->tree);
switch ($type) {
default:
@@ -1101,7 +1101,7 @@ class FamilyRepository
$top10 = [];
$i = 0;
foreach ($rows as $xref => $age) {
- $family = Family::getInstance((string) $xref, $this->tree);
+ $family = Factory::family()->make((string) $xref, $this->tree);
if ($type === 'name') {
return $family->formatList();
}
@@ -1290,7 +1290,7 @@ class FamilyRepository
->select(['families.*'])
->take($total)
->get()
- ->map(Family::rowMapper($this->tree))
+ ->map(Factory::family()->mapper($this->tree))
->filter(GedcomRecord::accessFilter())
->map(function (Family $family) use ($age_dir): array {
$husb_birt_jd = $family->husband()->getBirthDate()->minimumJulianDay();
@@ -1488,8 +1488,8 @@ class FamilyRepository
return '';
}
- $family = Family::getInstance($row->famid, $this->tree);
- $person = Individual::getInstance($row->i_id, $this->tree);
+ $family = Factory::family()->make($row->famid, $this->tree);
+ $person = Factory::individual()->make($row->i_id, $this->tree);
switch ($type) {
default:
diff --git a/app/Statistics/Repository/GedcomRepository.php b/app/Statistics/Repository/GedcomRepository.php
index 1c8e1ba38a..d1f89a5bf1 100644
--- a/app/Statistics/Repository/GedcomRepository.php
+++ b/app/Statistics/Repository/GedcomRepository.php
@@ -20,14 +20,12 @@ declare(strict_types=1);
namespace Fisharebest\Webtrees\Statistics\Repository;
use Fisharebest\Webtrees\Carbon;
-use Fisharebest\Webtrees\Date;
use Fisharebest\Webtrees\Fact;
-use Fisharebest\Webtrees\GedcomRecord;
+use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\Header;
use Fisharebest\Webtrees\Statistics\Repository\Interfaces\GedcomRepositoryInterface;
use Fisharebest\Webtrees\Tree;
use Illuminate\Database\Capsule\Manager as DB;
-use Illuminate\Database\Query\Builder;
/**
* A repository providing methods for GEDCOM related statistics.
@@ -60,7 +58,7 @@ class GedcomRepository implements GedcomRepositoryInterface
$version = '';
$source = '';
- $head = Header::getInstance('HEAD', $this->tree);
+ $head = Factory::header()->make('HEAD', $this->tree);
if ($head instanceof Header) {
$sour = $head->facts(['SOUR'])->first();
@@ -139,7 +137,7 @@ class GedcomRepository implements GedcomRepositoryInterface
*/
public function gedcomDate(): string
{
- $head = Header::getInstance('HEAD', $this->tree);
+ $head = Factory::header()->make('HEAD', $this->tree);
if ($head instanceof Header) {
$fact = $head->facts(['DATE'])->first();
diff --git a/app/Statistics/Repository/IndividualRepository.php b/app/Statistics/Repository/IndividualRepository.php
index ea71a3cb38..d621229f6e 100644
--- a/app/Statistics/Repository/IndividualRepository.php
+++ b/app/Statistics/Repository/IndividualRepository.php
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees\Statistics\Repository;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Carbon;
+use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\Functions\FunctionsPrintLists;
use Fisharebest\Webtrees\Gedcom;
use Fisharebest\Webtrees\GedcomRecord;
@@ -829,7 +830,7 @@ class IndividualRepository implements IndividualRepositoryInterface
}
/** @var Individual $individual */
- $individual = Individual::rowMapper($this->tree)($row);
+ $individual = Factory::individual()->mapper($this->tree)($row);
if (!$individual->canShow()) {
return I18N::translate('This information is private and cannot be shown.');
@@ -983,7 +984,7 @@ class IndividualRepository implements IndividualRepositoryInterface
$top10 = [];
foreach ($rows as $row) {
/** @var Individual $individual */
- $individual = Individual::rowMapper($this->tree)($row);
+ $individual = Factory::individual()->mapper($this->tree)($row);
if ($individual->canShow()) {
$top10[] = [
@@ -1125,7 +1126,7 @@ class IndividualRepository implements IndividualRepositoryInterface
->select(['individuals.*'])
->take($total)
->get()
- ->map(Individual::rowMapper($this->tree))
+ ->map(Factory::individual()->mapper($this->tree))
->filter(GedcomRecord::accessFilter())
->map(function (Individual $individual): array {
return [
diff --git a/app/Statistics/Repository/UserRepository.php b/app/Statistics/Repository/UserRepository.php
index 5789453e09..57d345e552 100644
--- a/app/Statistics/Repository/UserRepository.php
+++ b/app/Statistics/Repository/UserRepository.php
@@ -21,6 +21,7 @@ namespace Fisharebest\Webtrees\Statistics\Repository;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Contracts\UserInterface;
+use Fisharebest\Webtrees\Factory;
use Fisharebest\Webtrees\Http\RequestHandlers\MessagePage;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
@@ -110,7 +111,7 @@ class UserRepository implements UserRepositoryInterface
$content .= '<li>';
}
- $individual = Individual::getInstance($this->tree->getUserPreference($user, User::PREF_TREE_ACCOUNT_XREF), $this->tree);
+ $individual = Factory::individual()->make($this->tree->getUserPreference($user, User::PREF_TREE_ACCOUNT_XREF), $this->tree);
if ($individual instanceof Individual && $individual->canShow()) {
$content .= '<a href="' . e($individual->url()) . '">' . e($user->realName()) . '</a>';