MCPcopy Create free account
hub / github.com/ddev/ddev / DetectAppType

Method DetectAppType

pkg/ddevapp/apptypes.go:440–460  ·  view source on GitHub ↗

DetectAppType calls each apptype's detector until it finds a match, or returns 'php' as a last resort.

()

Source from the content-addressed store, hash-verified

438// DetectAppType calls each apptype's detector until it finds a match,
439// or returns 'php' as a last resort.
440func (app *DdevApp) DetectAppType() string {
441 // `generic` type should not be overridden
442 if app.Type == nodeps.AppTypeGeneric {
443 return app.Type
444 }
445 var keys []string
446 for k := range appTypeMatrix {
447 keys = append(keys, k)
448 }
449 sort.Strings(keys)
450
451 // Traverse in sorted order
452 for _, appTypeName := range keys {
453 appFuncs := appTypeMatrix[appTypeName]
454 if appFuncs.appTypeDetect != nil && appFuncs.appTypeDetect(app) {
455 return appTypeName
456 }
457 }
458
459 return nodeps.AppTypePHP
460}
461
462// PostImportDBAction calls each apptype's detector until it finds a match,
463// or returns 'php' as a last resort.

Callers 4

AppTypePromptMethod · 0.95
TestDetectAppTypeFunction · 0.80
PrepareMethod · 0.80
handleMainConfigArgsFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestDetectAppTypeFunction · 0.64