Skip to content

Commit 6fd2d71

Browse files
committed
format
1 parent e346f8e commit 6fd2d71

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/Parser.ts

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import phpParser from 'php-parser';
1+
import phpParser from 'php-parser';
22
import { ParsedResult } from './ParsedResult';
33
import { ClassInfo } from './ClassInfo';
44

@@ -18,32 +18,29 @@ export class Parser {
1818
withPositions: true
1919
}
2020
});
21-
2221
}
2322

24-
parse(): ParsedResult {
23+
public parse(): ParsedResult {
2524
return this.getClasses();
2625
}
2726

28-
getClasses(): ParsedResult {
27+
private getClasses(): ParsedResult {
2928
let parsedCode = this.parser.parseCode(this.text, '');
30-
29+
3130
return {
3231
useStatements: this.getUseStatements(parsedCode),
3332
classesUsed: this.getClassesInBody(parsedCode)
3433
};
3534
}
3635

37-
getClassesInBody(parsedCode: object): ClassInfo[] {
38-
39-
36+
private getClassesInBody(parsedCode: object): ClassInfo[] {
4037
let allClasses = [];
4138
this.getBodyElements(parsedCode).forEach(row => {
4239
if (this.isObject(row)) {
4340
allClasses.push(...this.getClassesForObject(row));
4441
}
4542
});
46-
43+
4744
allClasses = this.filterOutFunctions(allClasses);
4845

4946
return allClasses.concat(this.getExtendedClasses(parsedCode));
@@ -87,13 +84,13 @@ export class Parser {
8784

8885
Object.entries(row).forEach(([key, value]) => {
8986
if (key === 'kind' && value === 'classreference') {
90-
classes.push(new ClassInfo(row));
87+
classes.push(new ClassInfo(row));
9188
} else if (Array.isArray(value)) {
9289
value.forEach(row => {
9390
if (this.isObject(row)) {
9491
classes.push(...this.getClassesForObject(row));
9592
}
96-
});
93+
});
9794
} else if (this.isObject(value)) {
9895
classes.push(...this.getClassesForObject(value));
9996
}
@@ -109,7 +106,7 @@ export class Parser {
109106
return typeof value === 'object';
110107
}
111108

112-
getElements(parsedCode: any): any[] {
109+
private getElements(parsedCode: any): any[] {
113110
let children = parsedCode.children;
114111

115112
const nameSpaceObject = children.find(row => {
@@ -146,10 +143,10 @@ export class Parser {
146143
return [];
147144
}
148145

149-
getUseStatements(parsedCode: object): ClassInfo[] {
146+
private getUseStatements(parsedCode: object): ClassInfo[] {
150147
return this.getElements(parsedCode).flatMap(child => {
151148
if (child.kind === 'usegroup') {
152-
return child.items.map(item => {
149+
return child.items.map(item => {
153150
return new ClassInfo(item);
154151
});
155152
}

0 commit comments

Comments
 (0)