summaryrefslogtreecommitdiff
path: root/app/Statistics.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-02-22 14:55:39 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-02-22 14:55:39 +0000
commite6f3d5e222a2d3e300c90eeb0db5435cf5657235 (patch)
treeb712b3936ba87d042e625a32d5830b2729a8b3df /app/Statistics.php
parent86c5ba7b1ac4e2f9883df4956c0394be1b60b67e (diff)
downloadwebtrees-e6f3d5e222a2d3e300c90eeb0db5435cf5657235.tar.gz
webtrees-e6f3d5e222a2d3e300c90eeb0db5435cf5657235.tar.bz2
webtrees-e6f3d5e222a2d3e300c90eeb0db5435cf5657235.zip
Refactor statistics query functions to return queries
Diffstat (limited to 'app/Statistics.php')
-rw-r--r--app/Statistics.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/app/Statistics.php b/app/Statistics.php
index ccabdac2bf..ccc533cdac 100644
--- a/app/Statistics.php
+++ b/app/Statistics.php
@@ -52,6 +52,7 @@ use Fisharebest\Webtrees\Statistics\Repository\NewsRepository;
use Fisharebest\Webtrees\Statistics\Repository\PlaceRepository;
use Fisharebest\Webtrees\Statistics\Repository\ServerRepository;
use Fisharebest\Webtrees\Statistics\Repository\UserRepository;
+use Illuminate\Database\Query\Builder;
use ReflectionMethod;
/**
@@ -98,7 +99,6 @@ class Statistics implements
'statsPlaces',
'statsBirthQuery',
'statsDeathQuery',
- 'statsMarrQuery',
'statsAgeQuery',
'monthFirstChildQuery',
'statsChildrenQuery',
@@ -233,7 +233,7 @@ class Statistics implements
foreach (get_class_methods($this) as $method) {
$reflection = new ReflectionMethod($this, $method);
- if ($reflection->isPublic() && !\in_array($method, self::$public_but_not_allowed, true)) {
+ if ($reflection->isPublic() && !\in_array($method, self::$public_but_not_allowed, true) && (string) $reflection->getReturnType() !== Builder::class) {
$examples[$method] = $this->$method();
}
}
@@ -260,7 +260,7 @@ class Statistics implements
foreach (get_class_methods($this) as $method) {
$reflection = new ReflectionMethod($this, $method);
- if ($reflection->isPublic() && !\in_array($method, self::$public_but_not_allowed, true)) {
+ if ($reflection->isPublic() && !\in_array($method, self::$public_but_not_allowed, true) && (string) $reflection->getReturnType() !== Builder::class) {
$examples[$method] = $method;
}
}
@@ -1437,9 +1437,17 @@ class Statistics implements
/**
* @inheritDoc
*/
- public function statsMarrQuery(bool $first = false, int $year1 = -1, int $year2 = -1): array
+ public function statsMarriageQuery(int $year1 = -1, int $year2 = -1): Builder
{
- return $this->familyRepository->statsMarrQuery($first, $year1, $year2);
+ return $this->familyRepository->statsMarriageQuery($year1, $year2);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function statsFirstMarriageQuery(int $year1 = -1, int $year2 = -1): Builder
+ {
+ return $this->familyRepository->statsFirstMarriageQuery($year1, $year2);
}
/**