From ebd53fe4b74cd665a230a90f5e3f634a491c3203 Mon Sep 17 00:00:00 2001 From: jamescowie Date: Tue, 22 Mar 2016 17:16:17 +0000 Subject: [PATCH 1/2] Add a check so that modules can check if already registered or not --- .../Framework/Component/ComponentRegistrar.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php index ba7ebdf49dc43..114cf10bf4d54 100644 --- a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php +++ b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php @@ -55,6 +55,18 @@ public static function register($type, $componentName, $path) } } + /** + * Returns if a component is already registered with the system + * + * @param $type + * @param $componentName + * @return bool + */ + public static function checkRegisteredComponent($type, $componentName) + { + return isset(self::$paths[$type][$componentName]); + } + /** * {@inheritdoc} */ From 94c3cb6f26d49aa6610a78f8d2cc0cfbe34f5aff Mon Sep 17 00:00:00 2001 From: jamescowie Date: Tue, 22 Mar 2016 19:01:12 +0000 Subject: [PATCH 2/2] Update PHPDoc block --- .../Magento/Framework/Component/ComponentRegistrar.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php index 114cf10bf4d54..6066d5803c1a5 100644 --- a/lib/internal/Magento/Framework/Component/ComponentRegistrar.php +++ b/lib/internal/Magento/Framework/Component/ComponentRegistrar.php @@ -58,8 +58,8 @@ public static function register($type, $componentName, $path) /** * Returns if a component is already registered with the system * - * @param $type - * @param $componentName + * @param string $type component type + * @param string $componentName Fully-qualified component name * @return bool */ public static function checkRegisteredComponent($type, $componentName)