1
|
|
|
<?php |
2
|
|
|
namespace gossi\codegen\generator; |
3
|
|
|
|
4
|
|
|
use gossi\codegen\generator\comparator\DefaultConstantComparator; |
5
|
|
|
use gossi\codegen\generator\comparator\DefaultMethodComparator; |
6
|
|
|
use gossi\codegen\generator\comparator\DefaultPropertyComparator; |
7
|
|
|
use gossi\codegen\generator\comparator\DefaultUseStatementComparator; |
8
|
|
|
use phootwork\lang\Comparator; |
9
|
|
|
|
10
|
|
|
class ComparatorFactory { |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Creates a comparator for use statements |
14
|
|
|
* |
15
|
|
|
* @param string $type |
16
|
|
|
* @return Comparator |
17
|
|
|
*/ |
18
|
14 |
|
public static function createUseStatementComparator($type) { |
|
|
|
|
19
|
|
|
// switch ($type) { |
|
|
|
|
20
|
|
|
// case CodeGenerator::SORT_USESTATEMENTS_DEFAULT: |
21
|
|
|
// default: |
22
|
|
|
// return new DefaultUseStatementComparator(); |
23
|
|
|
// } |
24
|
14 |
|
return new DefaultUseStatementComparator(); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Creates a comparator for constants |
29
|
|
|
* |
30
|
|
|
* @param string $type |
31
|
|
|
* @return Comparator |
32
|
|
|
*/ |
33
|
13 |
|
public static function createConstantComparator($type) { |
|
|
|
|
34
|
|
|
// switch ($type) { |
|
|
|
|
35
|
|
|
// case CodeGenerator::SORT_CONSTANTS_DEFAULT: |
36
|
|
|
// default: |
37
|
|
|
// return new DefaultConstantComparator(); |
38
|
|
|
// } |
39
|
13 |
|
return new DefaultConstantComparator(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Creates a comparator for properties |
44
|
|
|
* |
45
|
|
|
* @param string $type |
46
|
|
|
* @return Comparator |
47
|
|
|
*/ |
48
|
12 |
|
public static function createPropertyComparator($type) { |
|
|
|
|
49
|
|
|
// switch ($type) { |
|
|
|
|
50
|
|
|
// case CodeGenerator::SORT_PROPERTIES_DEFAULT: |
51
|
|
|
// default: |
52
|
|
|
// return new DefaultPropertyComparator(); |
53
|
|
|
// } |
54
|
12 |
|
return new DefaultPropertyComparator(); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Creates a comparator for methods |
59
|
|
|
* |
60
|
|
|
* @param string $type |
61
|
|
|
* @return Comparator |
62
|
|
|
*/ |
63
|
14 |
|
public static function createMethodComparator($type) { |
|
|
|
|
64
|
|
|
// switch ($type) { |
|
|
|
|
65
|
|
|
// case CodeGenerator::SORT_METHODS_DEFAULT: |
66
|
|
|
// default: |
67
|
|
|
// return new DefaultMethodComparator(); |
68
|
|
|
// } |
69
|
14 |
|
return new DefaultMethodComparator(); |
70
|
|
|
} |
71
|
|
|
} |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.