diff options
| author | Greg Roach <fisharebest@webtrees.net> | 2019-10-15 20:51:18 +0100 |
|---|---|---|
| committer | Greg Roach <fisharebest@webtrees.net> | 2019-10-15 23:05:57 +0100 |
| commit | 5229eade2a8cdd1381e19f96f67fc1c8b92ca95d (patch) | |
| tree | 007749d01fdfd56b668f6ecee309371b6a6d1a33 /app/Module/StatisticsChartModule.php | |
| parent | 9b5c959707d56fc73446942abbe205a42e3c07cf (diff) | |
| download | webtrees-5229eade2a8cdd1381e19f96f67fc1c8b92ca95d.tar.gz webtrees-5229eade2a8cdd1381e19f96f67fc1c8b92ca95d.tar.bz2 webtrees-5229eade2a8cdd1381e19f96f67fc1c8b92ca95d.zip | |
Refactor the re-ordering of children/spouses/names/media; add assertions
Diffstat (limited to 'app/Module/StatisticsChartModule.php')
| -rw-r--r-- | app/Module/StatisticsChartModule.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/Module/StatisticsChartModule.php b/app/Module/StatisticsChartModule.php index a089e4200d..c1c8bc5228 100644 --- a/app/Module/StatisticsChartModule.php +++ b/app/Module/StatisticsChartModule.php @@ -23,6 +23,8 @@ use Fisharebest\Webtrees\Date; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Statistics; +use Fisharebest\Webtrees\Tree; +use InvalidArgumentException; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -35,6 +37,7 @@ use function array_merge; use function array_sum; use function array_values; use function array_walk; +use function assert; use function count; use function explode; use function in_array; @@ -140,6 +143,8 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa public function getChartAction(ServerRequestInterface $request): ResponseInterface { $tree = $request->getAttribute('tree'); + assert($tree instanceof Tree, new InvalidArgumentException()); + $user = $request->getAttribute('user'); Auth::checkComponentAccess($this, 'chart', $tree, $user); @@ -227,6 +232,7 @@ class StatisticsChartModule extends AbstractModule implements ModuleChartInterfa $this->layout = 'layouts/ajax'; $tree = $request->getAttribute('tree'); + assert($tree instanceof Tree, new InvalidArgumentException()); return $this->viewResponse('modules/statistics-chart/custom', [ 'module' => $this, |
