@@ -5,40 +5,38 @@ class AnalyzerPhpPure < Analyzer
5
5
def analyze
6
6
# Source Analysis
7
7
Dir .glob(" #{ base_path } /**/*" ) do |path |
8
- spawn do
9
- next if File .directory?(path)
10
- if base_path[-1 ].to_s == " /"
11
- relative_path = path.sub(" #{ base_path } " , " " ).sub(" ./" , " " ).sub(" //" , " /" )
12
- else
13
- relative_path = path.sub(" #{ base_path } /" , " " ).sub(" ./" , " " ).sub(" //" , " /" )
14
- end
15
- relative_path = remove_start_slash(relative_path)
8
+ next if File .directory?(path)
9
+ if base_path[-1 ].to_s == " /"
10
+ relative_path = path.sub(" #{ base_path } " , " " ).sub(" ./" , " " ).sub(" //" , " /" )
11
+ else
12
+ relative_path = path.sub(" #{ base_path } /" , " " ).sub(" ./" , " " ).sub(" //" , " /" )
13
+ end
14
+ relative_path = remove_start_slash(relative_path)
16
15
17
- if File .exists?(path) && File .extname(path) == " .php"
18
- File .open(path, " r" ) do |file |
19
- params_query = [] of Param
20
- params_body = [] of Param
21
- methods = [] of String
16
+ if File .exists?(path) && File .extname(path) == " .php"
17
+ File .open(path, " r" ) do |file |
18
+ params_query = [] of Param
19
+ params_body = [] of Param
20
+ methods = [] of String
22
21
23
- file.each_line do |line |
24
- match = line.strip.match(%r{.*\$ _(.*?) \[ '(.*?) '\] ;} )
22
+ file.each_line do |line |
23
+ match = line.strip.match(%r{.*\$ _(.*?) \[ '(.*?) '\] ;} )
25
24
26
- if match
27
- method = match[1 ]
28
- param_name = match[2 ]
25
+ if match
26
+ method = match[1 ]
27
+ param_name = match[2 ]
29
28
30
- methods = methods | [method]
31
- params_query << Param .new(param_name, " string" , " query" )
32
- params_body << Param .new(param_name, " string" , " form" )
33
- end
34
- rescue
35
- next
29
+ methods = methods | [method]
30
+ params_query << Param .new(param_name, " string" , " query" )
31
+ params_body << Param .new(param_name, " string" , " form" )
36
32
end
37
- methods.each do |method |
38
- result << Endpoint .new(" #{ url } /#{ relative_path } " , method, params_body)
39
- end
40
- result << Endpoint .new(" #{ url } /#{ relative_path } " , " GET" , params_query)
33
+ rescue
34
+ next
35
+ end
36
+ methods.each do |method |
37
+ result << Endpoint .new(" #{ url } /#{ relative_path } " , method, params_body)
41
38
end
39
+ result << Endpoint .new(" #{ url } /#{ relative_path } " , " GET" , params_query)
42
40
end
43
41
end
44
42
end
0 commit comments