( filePath: string, content: string, declarations: readonly AttributedDeclaration[] )
| 598 | } |
| 599 | |
| 600 | function extractDrupalPlugins( |
| 601 | filePath: string, |
| 602 | content: string, |
| 603 | declarations: readonly AttributedDeclaration[] |
| 604 | ): { nodes: Node[]; references: UnresolvedRef[] } { |
| 605 | const nodes: Node[] = []; |
| 606 | const references: UnresolvedRef[] = []; |
| 607 | if (!PLUGIN_FILE.test(filePath) || TEST_FILE.test(filePath)) return { nodes, references }; |
| 608 | const now = Date.now(); |
| 609 | for (const { type, id, className, line } of pluginDefinitions(content, declarations)) { |
| 610 | const node: Node = { |
| 611 | id: `component:${filePath}:${line}:plugin:${type}:${id}`, |
| 612 | kind: 'component', |
| 613 | name: `${type}:${id}`, |
| 614 | qualifiedName: `${filePath}::plugin:${type}:${id}`, |
| 615 | filePath, |
| 616 | startLine: line, |
| 617 | endLine: line, |
| 618 | startColumn: 0, |
| 619 | endColumn: 0, |
| 620 | language: 'php', |
| 621 | updatedAt: now, |
| 622 | }; |
| 623 | nodes.push(node); |
| 624 | references.push({ |
| 625 | fromNodeId: node.id, |
| 626 | referenceName: `${CLASS_REF}${filePath}#${className}`, |
| 627 | referenceKind: 'references', |
| 628 | line, |
| 629 | column: 0, |
| 630 | filePath, |
| 631 | language: 'php', |
| 632 | }); |
| 633 | } |
| 634 | return { nodes, references }; |
| 635 | } |
| 636 | |
| 637 | // --------------------------------------------------------------------------- |
| 638 | // Resolving through the service container |
no test coverage detected