MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extractDrupalPlugins

Function extractDrupalPlugins

src/resolution/frameworks/drupal.ts:600–635  ·  view source on GitHub ↗
(
  filePath: string,
  content: string,
  declarations: readonly AttributedDeclaration[]
)

Source from the content-addressed store, hash-verified

598}
599
600function 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

Callers 1

extractFunction · 0.85

Calls 2

pluginDefinitionsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected