Ejemplo n.º 1
0
 protected function addRootModuleFileToJson(RootModuleFile $moduleFile, stdClass $jsonData)
 {
     $overrideOrder = $moduleFile->getOverrideOrder();
     $installInfos = $moduleFile->getInstallInfos();
     // Pass false to exclude base configuration values
     $configValues = $moduleFile->getConfig()->toRawArray(false);
     if (count($overrideOrder) > 0) {
         $jsonData->{'override-order'} = $overrideOrder;
     }
     if (count($configValues) > 0) {
         $jsonData->config = (object) $configValues;
     }
     if (array() !== $moduleFile->getPluginClasses()) {
         $jsonData->plugins = $moduleFile->getPluginClasses();
         sort($jsonData->plugins);
     }
     if (count($installInfos) > 0) {
         $modulesData = array();
         foreach ($installInfos as $installInfo) {
             $installData = new stdClass();
             $installData->{'install-path'} = $installInfo->getInstallPath();
             if (InstallInfo::DEFAULT_INSTALLER_NAME !== $installInfo->getInstallerName()) {
                 $installData->installer = $installInfo->getInstallerName();
             }
             if ($installInfo->hasDisabledBindingUuids()) {
                 $installData->{'disabled-bindings'} = array();
                 foreach ($installInfo->getDisabledBindingUuids() as $uuid) {
                     $installData->{'disabled-bindings'}[] = $uuid->toString();
                 }
                 sort($installData->{'disabled-bindings'});
             }
             if (Environment::PROD !== $installInfo->getEnvironment()) {
                 $installData->env = $installInfo->getEnvironment();
             }
             $modulesData[$installInfo->getModuleName()] = $installData;
         }
         ksort($modulesData);
         $jsonData->modules = (object) $modulesData;
     }
 }