summaryrefslogtreecommitdiff
path: root/app/Report/ReportExpressionLanguageProvider.php
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2018-09-11 18:24:51 +0100
committerGreg Roach <fisharebest@webtrees.net>2018-09-11 18:24:51 +0100
commitcb63a60ec25218d0f60e4b9099e2b63da6d3eab5 (patch)
tree397085ed58c0f4a64bf2d95fb6b6f45d47207d4b /app/Report/ReportExpressionLanguageProvider.php
parent16371bee8867ad29bdf9955f241a602a5c708170 (diff)
downloadwebtrees-cb63a60ec25218d0f60e4b9099e2b63da6d3eab5.tar.gz
webtrees-cb63a60ec25218d0f60e4b9099e2b63da6d3eab5.tar.bz2
webtrees-cb63a60ec25218d0f60e4b9099e2b63da6d3eab5.zip
Fix: #1842 - support PHP functions in report expressions
Diffstat (limited to 'app/Report/ReportExpressionLanguageProvider.php')
-rw-r--r--app/Report/ReportExpressionLanguageProvider.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/Report/ReportExpressionLanguageProvider.php b/app/Report/ReportExpressionLanguageProvider.php
new file mode 100644
index 0000000000..5d75e4855d
--- /dev/null
+++ b/app/Report/ReportExpressionLanguageProvider.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * webtrees: online genealogy
+ * Copyright (C) 2018 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
+ * (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ * 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\Report;
+
+use Symfony\Component\ExpressionLanguage\ExpressionFunction;
+use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
+
+/**
+ * Class ReportExpressionLanguageProvider - support functions in report expressions.
+ */
+class ReportExpressionLanguageProvider implements ExpressionFunctionProviderInterface
+{
+ /**
+ * @return ExpressionFunction[]
+ */
+ public function getFunctions(): array
+ {
+ return [
+ ExpressionFunction::fromPhp('stristr'),
+ ];
+ }
+}