xref: /webtrees/app/Helpers/functions.php (revision 1f3fb95c905e623518962b025974a0e6c19d068b)
1*1f3fb95cSGreg Roach<?php
2*1f3fb95cSGreg Roach/**
3*1f3fb95cSGreg Roach * webtrees: online genealogy
4*1f3fb95cSGreg Roach * Copyright (C) 2017 webtrees development team
5*1f3fb95cSGreg Roach * This program is free software: you can redistribute it and/or modify
6*1f3fb95cSGreg Roach * it under the terms of the GNU General Public License as published by
7*1f3fb95cSGreg Roach * the Free Software Foundation, either version 3 of the License, or
8*1f3fb95cSGreg Roach * (at your option) any later version.
9*1f3fb95cSGreg Roach * This program is distributed in the hope that it will be useful,
10*1f3fb95cSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*1f3fb95cSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12*1f3fb95cSGreg Roach * GNU General Public License for more details.
13*1f3fb95cSGreg Roach * You should have received a copy of the GNU General Public License
14*1f3fb95cSGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
15*1f3fb95cSGreg Roach */
16*1f3fb95cSGreg Roach
17*1f3fb95cSGreg Roachuse Fisharebest\Webtrees\Html;
18*1f3fb95cSGreg Roach
19*1f3fb95cSGreg Roach/**
20*1f3fb95cSGreg Roach * Dump the passed variables and end the script.
21*1f3fb95cSGreg Roach *
22*1f3fb95cSGreg Roach * @param  mixed
23*1f3fb95cSGreg Roach *
24*1f3fb95cSGreg Roach * @return void
25*1f3fb95cSGreg Roach */
26*1f3fb95cSGreg Roachfunction dd(...$args): void
27*1f3fb95cSGreg Roach{
28*1f3fb95cSGreg Roach	foreach ($args as $x) {
29*1f3fb95cSGreg Roach		var_dump($x);
30*1f3fb95cSGreg Roach	}
31*1f3fb95cSGreg Roach
32*1f3fb95cSGreg Roach	die(1);
33*1f3fb95cSGreg Roach}
34*1f3fb95cSGreg Roach
35*1f3fb95cSGreg Roach/**
36*1f3fb95cSGreg Roach * Generate a URL for a named route.
37*1f3fb95cSGreg Roach *
38*1f3fb95cSGreg Roach * @param string $route
39*1f3fb95cSGreg Roach * @param array  $parameters
40*1f3fb95cSGreg Roach *
41*1f3fb95cSGreg Roach * @return string
42*1f3fb95cSGreg Roach */
43*1f3fb95cSGreg Roachfunction route(string $route, array $parameters = []): string {
44*1f3fb95cSGreg Roach	$parameters = ['route' => $route] + $parameters;
45*1f3fb95cSGreg Roach
46*1f3fb95cSGreg Roach	return Html::url('index.php', $parameters);
47*1f3fb95cSGreg Roach}
48