From 4ada86876033fa171e2896d7e3d3c5645d8062db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:46:47 +0200 Subject: Adding upstream version 0.10.0. Signed-off-by: Daniel Baumann --- library/Reporting/Hook/ActionHook.php | 37 +++++++++++ library/Reporting/Hook/ReportHook.php | 116 ++++++++++++++++++++++++++++++++++ 2 files changed, 153 insertions(+) create mode 100644 library/Reporting/Hook/ActionHook.php create mode 100644 library/Reporting/Hook/ReportHook.php (limited to 'library/Reporting/Hook') diff --git a/library/Reporting/Hook/ActionHook.php b/library/Reporting/Hook/ActionHook.php new file mode 100644 index 0000000..ef550ee --- /dev/null +++ b/library/Reporting/Hook/ActionHook.php @@ -0,0 +1,37 @@ +getDeclaringClass()->getName() !== self::class; + } + + /** + * Get whether the report provides HTML + * + * @return bool + */ + public function providesHtml() + { + try { + $method = new \ReflectionMethod($this, 'getHtml'); + } catch (\ReflectionException $e) { + return false; + } + + return $method->getDeclaringClass()->getName() !== self::class; + } + + /** + * Get the module name of the report + * + * @return string + */ + final public function getModuleName() + { + return ClassLoader::extractModuleName(get_class($this)); + } + + /** + * Get all provided reports + * + * @return ReportHook[] + */ + final public static function getReports() + { + return Hook::all('reporting/Report'); + } +} -- cgit v1.2.3