Conditions | 1 |
Paths | 1 |
Total Lines | 82 |
Code Lines | 50 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 0 | Features | 3 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
51 | public function getEntityIdsForQueryProvider() { |
||
52 | return [ |
||
53 | [ |
||
54 | new SomeProperty( |
||
55 | new EntityIdValue( new PropertyId( 'P1' ) ), |
||
56 | new AnyValue() |
||
57 | ), |
||
58 | new ClaimQuery( new PropertyId( 'P1' ) ) |
||
59 | ], |
||
60 | [ |
||
61 | new SomeProperty( |
||
62 | new EntityIdValue( new PropertyId( 'P1' ) ), |
||
63 | new ValueDescription( new EntityIdValue( new ItemId( 'Q1' ) ) ) |
||
64 | ), |
||
65 | new ClaimQuery( new PropertyId( 'P1' ), new ItemId( 'Q1' ) ) |
||
66 | ], |
||
67 | [ |
||
68 | new Conjunction( [ |
||
69 | new SomeProperty( |
||
70 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
71 | new ValueDescription( new StringValue( 'foo' ) ) |
||
72 | ), |
||
73 | new SomeProperty( |
||
74 | new EntityIdValue( new PropertyId( 'P1' ) ), |
||
75 | new ValueDescription( new EntityIdValue( new ItemId( 'Q42' ) ) ) |
||
76 | ) |
||
77 | ] ), |
||
78 | new AndQuery( [ |
||
79 | new StringQuery( new PropertyId( 'P42' ), new StringValue( 'foo' ) ), |
||
80 | new ClaimQuery( new PropertyId( 'P1' ), new ItemId( 'Q42' ) ) |
||
81 | ] ) |
||
82 | ], |
||
83 | [ |
||
84 | new Disjunction( [ |
||
85 | new SomeProperty( |
||
86 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
87 | new ValueDescription( new StringValue( 'foo' ) ) |
||
88 | ), |
||
89 | new SomeProperty( |
||
90 | new EntityIdValue( new PropertyId( 'P1' ) ), |
||
91 | new ValueDescription( new EntityIdValue( new ItemId( 'Q42' ) ) ) |
||
92 | ) |
||
93 | ] ), |
||
94 | new OrQuery( [ |
||
95 | new StringQuery( new PropertyId( 'P42' ), new StringValue( 'foo' ) ), |
||
96 | new ClaimQuery( new PropertyId( 'P1' ), new ItemId( 'Q42' ) ) |
||
97 | ] ) |
||
98 | ], |
||
99 | [ |
||
100 | new SomeProperty( |
||
101 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
102 | new Conjunction( [ |
||
103 | new Disjunction( [ |
||
104 | new ValueDescription( new StringValue( 'foo' ) ) |
||
105 | ] ), |
||
106 | new AnyValue(), |
||
107 | new ValueDescription( new EntityIdValue( new ItemId( 'Q42' ) ) ) |
||
108 | ] ) |
||
109 | ), |
||
110 | new AndQuery( [ |
||
111 | new OrQuery( [ |
||
112 | new StringQuery( new PropertyId( 'P42' ), new StringValue( 'foo' ) ) |
||
113 | ] ), |
||
114 | new ClaimQuery( new PropertyId( 'P42' ) ), |
||
115 | new ClaimQuery( new PropertyId( 'P42' ), new ItemId( 'Q42' ) ) |
||
116 | ] ) |
||
117 | ], |
||
118 | [ |
||
119 | new SomeProperty( |
||
120 | new EntityIdValue( new PropertyId( 'P42' ) ), |
||
121 | new ValueDescription( |
||
122 | new TimeValue( '+00000001952-03-11T00:00:00Z', 0, 0, 0, TimeValue::PRECISION_DAY, 'foo' ) |
||
123 | ) |
||
124 | ), |
||
125 | new BetweenQuery( |
||
126 | new PropertyId( 'P42' ), |
||
127 | new TimeValue( '+00000001952-03-11T00:00:00Z', 0, 0, 0, TimeValue::PRECISION_DAY, 'foo' ), |
||
128 | new TimeValue( '+00000001952-03-11T00:00:00Z', 0, 0, 0, TimeValue::PRECISION_DAY, 'foo' ) |
||
129 | ) |
||
130 | ], |
||
131 | ]; |
||
132 | } |
||
133 | |||
198 |