protected function callModulesMethod($methodName)
    {
        $modules = Yii::$app->getModules();
        $returns = [];

        foreach ($modules as $moduleName => $module)
        {
            if (is_array($module)) {
                $module = Yii::$app->getModule($moduleName);
            }

            if (method_exists($module, $methodName)) {
                $returns[] = $module->$methodName();
            }
        }

        return $returns;
    }
protected function callModulesMethod($methodName)
    {
        $modules = Yii::$app->getModules();
        $returns = [];

        foreach ($modules as $moduleName => $module)
        {
            if (is_array($module)) {
                $module = Yii::$app->getModule($moduleName);
            }

            if (method_exists($module, $methodName)) {
                $returns[] = $module->$methodName();
            }
        }

        return $returns;
    }
protected function callModulesMethod ( $ methodName ) { $ modules = Yii :: $ app -> getModules ( ) ; $ returns = [ ] ; foreach ( $ modules as $ moduleName => $ module ) { if ( is_array ( $ module ) ) { $ module = Yii :: $ app -> getModule ( $ moduleName ) ; } if ( method_exists ( $ module , $ methodName ) ) { $ returns [ ] = $ module -> $ methodName ( ) ; } } return $ returns ; }
Call a method if exists on every application modules

@param string $methodName The method to call

@return mixed[]
Call a method if exists on every application modules