diff --git a/Classes/Utility/InterfaceUtility.php b/Classes/Utility/InterfaceUtility.php new file mode 100644 index 0000000..db5ae8f --- /dev/null +++ b/Classes/Utility/InterfaceUtility.php @@ -0,0 +1,40 @@ + + * + ***/ + +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; + +/** + * + */ +class InterfaceUtility +{ + + /** + * Get all interface constants per prefix + */ + public static function parseInterfaceConstants( + $interfaceClass, $prefix + ) { + $constants = (new \ReflectionClass($interfaceClass)) + ->getConstants(); + $constants = array_filter($constants, function($key) use ($prefix) { + if (substr($key, 0, strlen($prefix) + 1) + == strtoupper($prefix) . '_' + ) { + return true; + } + }, ARRAY_FILTER_USE_KEY); + return array_values($constants); + } +}