class

Analyzer::Php::CakePHP

Inherits Analyzer::Php::PhpEngine < FileScanEngine < Analyzer < FileHelper < Reference < Object

Constants

CONNECT_REGEX = /(\$\w+|Router)(?:->|::)connect\s*\(\s*['"]([^'"]+)['"](.*?);/im

Route receivers in a CakePHP routes file: the injected builder under any variable name ($routes, $builder, $routeBuilder, ...) or the static Router facade used by older apps and plugin route files (croogo).

HYPERF_MARKER_RE = /Hyperf\\/

Hyperf keeps its route table at config/routes.php too, and writes it as Router::get('/items/{itemId}', …) — a call shape CakePHP 3 also used, so the verb matchers below hit it. In a repo holding both, CakePHP reported Hyperf's routes as its own. Hyperf\ is unambiguous: the file imports Hyperf\HttpServer\Router\Router, and CakePHP never names it.

RESOURCE_REGEX = /(\$\w+|Router)(?:->|::)resources\s*\(\s*['"]([^'"]+)['"]/im
SCOPE_OPEN_REGEX = /(?:\$\w+|Router)(?:->|::)(scope|prefix|plugin)\s*\(/im
VERB_REGEXES = {"GET" => /(\$\w+|Router)(?:->|::)get\s*\(\s*['"]([^'"]+)['"](?:\s*,\s*\[(.*?)\])?/im, "POST" => /(\$\w+|Router)(?:->|::)post\s*\(\s*['"]([^'"]+)['"](?:\s*,\s*\[(.*?)\])?/im, "PUT" => /(\$\w+|Router)(?:->|::)put\s*\(\s*['"]([^'"]+)['"](?:\s*,\s*\[(.*?)\])?/im, "PATCH" => /(\$\w+|Router)(?:->|::)patch\s*\(\s*['"]([^'"]+)['"](?:\s*,\s*\[(.*?)\])?/im, "DELETE" => /(\$\w+|Router)(?:->|::)delete\s*\(\s*['"]([^'"]+)['"](?:\s*,\s*\[(.*?)\])?/im, "OPTIONS" => /(\$\w+|Router)(?:->|::)options\s*\(\s*['"]([^'"]+)['"](?:\s*,\s*\[(.*?)\])?/im, "HEAD" => /(\$\w+|Router)(?:->|::)head\s*\(\s*['"]([^'"]+)['"](?:\s*,\s*\[(.*?)\])?/im}

Class methods

tech_name
Source

Instance methods

analyze_file(path : String) : Array(Endpoint)
Source
tech

Instance-side view of the same declaration. The per-file rescues live on this base class, which has no way to name the analyzer that is running inside them, so a skipped file could not be attributed to a tech. Deriving it from analyzer_for keeps the name written exactly once.

Source