Conditions | 3 |
Paths | 3 |
Total Lines | 135 |
Code Lines | 53 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
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 |
||
36 | public function typesDataProvider(): array |
||
37 | { |
||
38 | $data = [ |
||
39 | // #0 |
||
40 | [ |
||
41 | [ |
||
42 | DynamicRoutesTestClass::TYPES_ROUTE_CATALOG_INT_BAR |
||
43 | ], |
||
44 | '/catalog/1/', |
||
45 | 1 |
||
46 | ], |
||
47 | // #1 |
||
48 | [ |
||
49 | [ |
||
50 | DynamicRoutesTestClass::TYPES_ROUTE_CATALOG_INT_BAR |
||
51 | ], |
||
52 | '/catalog/-1/', |
||
53 | - 1 |
||
54 | ], |
||
55 | // #2 |
||
56 | [ |
||
57 | [ |
||
58 | DynamicRoutesTestClass::TYPES_ROUTE_CATALOG_INT_BAR |
||
59 | ], |
||
60 | '/catalog/+1/', |
||
61 | 1 |
||
62 | ], |
||
63 | // #3 |
||
64 | [ |
||
65 | [ |
||
66 | DynamicRoutesTestClass::TYPES_ROUTE_CATALOG_FIX_POINT_BAR |
||
67 | ], |
||
68 | '/catalog/1.1/', |
||
69 | 1.1 |
||
70 | ], |
||
71 | // #4 |
||
72 | [ |
||
73 | [ |
||
74 | DynamicRoutesTestClass::TYPES_ROUTE_CATALOG_FIX_POINT_BAR |
||
75 | ], |
||
76 | '/catalog/-1.1/', |
||
77 | - 1.1 |
||
78 | ], |
||
79 | // #5 |
||
80 | [ |
||
81 | [ |
||
82 | DynamicRoutesTestClass::TYPES_ROUTE_CATALOG_FIX_POINT_BAR |
||
83 | ], |
||
84 | '/catalog/+1.1/', |
||
85 | 1.1 |
||
86 | ], |
||
87 | // #6 |
||
88 | [ |
||
89 | [ |
||
90 | '/[a:bar]/' |
||
91 | ], |
||
92 | '/.-@/', |
||
93 | '.-@' |
||
94 | ], |
||
95 | // #7 |
||
96 | [ |
||
97 | [ |
||
98 | '/[s:bar]/' |
||
99 | ], |
||
100 | '/, ;:/', |
||
101 | ', ;:' |
||
102 | ], |
||
103 | // #8 |
||
104 | [ |
||
105 | [ |
||
106 | '/[fp:number]/', |
||
107 | '/[s:bar]/' |
||
108 | ], |
||
109 | '/abc/', |
||
110 | 'abc' |
||
111 | ], |
||
112 | // #9 |
||
113 | [ |
||
114 | [ |
||
115 | '/catalog/[il:bar]/' |
||
116 | ], |
||
117 | '/catalog/123,456,789/', |
||
118 | '123,456,789' |
||
119 | ], |
||
120 | // #10 |
||
121 | [ |
||
122 | [ |
||
123 | '/catalog/[s:bar]/' |
||
124 | ], |
||
125 | '/catalog/123&456/', |
||
126 | '123&456' |
||
127 | ], |
||
128 | // #11, parameter name chars testing |
||
129 | [ |
||
130 | [ |
||
131 | '/[s:Aa_x-0]/' |
||
132 | ], |
||
133 | '/abc123/', |
||
134 | 'abc123', |
||
135 | 'Aa_x-0' |
||
136 | ], |
||
137 | // #12, date type testing 1 |
||
138 | [ |
||
139 | [ |
||
140 | '/[date:dfield]/' |
||
141 | ], |
||
142 | '/2020-02-02/', |
||
143 | '2020-02-02', |
||
144 | 'dfield' |
||
145 | ], |
||
146 | // #13, date type testing 2 |
||
147 | [ |
||
148 | [ |
||
149 | '/posts-[date:dfield]/' |
||
150 | ], |
||
151 | '/posts-2020-02-02/', |
||
152 | '2020-02-02', |
||
153 | 'dfield' |
||
154 | ] |
||
155 | ]; |
||
156 | |||
157 | $return = []; |
||
158 | |||
159 | foreach (SuppportedRequestMethods::getListOfSupportedRequestMethods() as $method) { |
||
160 | $tmp = array_merge($data); |
||
161 | |||
162 | foreach ($tmp as $item) { |
||
163 | $item = array_merge([ |
||
164 | $method |
||
165 | ], $item); |
||
166 | $return[] = $item; |
||
167 | } |
||
168 | } |
||
169 | |||
170 | return $return; |
||
171 | } |
||
263 |