Skip to content

LaravelParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/backend/laravel.parser.ts

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(_config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • LaravelParser stops the work with an early return when !source.trim().
  • LaravelParser stops the work with an early return when !/(\bRoute\s*::|\bSchema\s*::|\bclass\s+\w+|->\s*withRouting)/.test(source).
  • LaravelParser stops the work with an early return when method === 'group'.
  • LaravelParser stops the work with an early return when !/RouteServiceProvider|withRouting/.test(clean).
  • LaravelParser stops the work with an early return when !header.
  • LaravelParser stops the work with an early return when !rules.

When something fails

  • LaravelParser handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF