(context: ResolutionContext)
| 71 | } |
| 72 | |
| 73 | function classTable(context: ResolutionContext): ClassTable { |
| 74 | const all = context.getNodesByKind('class'); |
| 75 | const cached = tables.get(context); |
| 76 | if (cached && cached.source === all) return cached; |
| 77 | const table: ClassTable = { source: all, loadable: new Map(), controllers: new Map(), aliases: new Map() }; |
| 78 | for (const node of all) { |
| 79 | if (node.language !== 'php') continue; |
| 80 | const url = controllerUrl(node.filePath); |
| 81 | if (url !== null) add(table.controllers, url.slice(1), node); |
| 82 | else if (LOADABLE_FILE.test(node.filePath)) add(table.loadable, node.name.toLowerCase(), node); |
| 83 | } |
| 84 | tables.set(context, table); |
| 85 | return table; |
| 86 | } |
| 87 | |
| 88 | /** The URL a controller's `index` answers at, or null for a file that isn't one. */ |
| 89 | function controllerUrl(filePath: string): string | null { |
no test coverage detected