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

Function serviceOnLine

src/resolution/frameworks/drupal.ts:685–691  ·  view source on GitHub ↗

The service the `\Drupal::service('x')->method()` on this reference's line asks for.

(ref: UnresolvedRef, method: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

683
684/** The service the `\Drupal::service('x')->method()` on this reference's line asks for. */
685function serviceOnLine(ref: UnresolvedRef, method: string, context: ResolutionContext): string | null {
686 const line = context.getFileLines?.(ref.filePath)?.[ref.line - 1] ?? '';
687 for (const m of line.matchAll(/Drupal::service\(\s*['"]([\w.\\-]+)['"]\s*\)\s*->\s*(\w+)/g)) {
688 if (m[2] === method) return m[1]!;
689 }
690 return null;
691}
692
693// ---------------------------------------------------------------------------
694// Resolver

Callers 1

resolveFunction · 0.85

Calls 1

getFileLinesMethod · 0.80

Tested by

no test coverage detected