Conditions | 1 |
Paths | 1 |
Total Lines | 90 |
Lines | 0 |
Ratio | 0 % |
Changes | 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 |
||
33 | public function renderProvider() { |
||
34 | return [ |
||
35 | [ |
||
36 | new Page( Title::newFromText( 'AAA' ) ), |
||
37 | PlainPageRenderer::PATH_FULL, |
||
38 | 'AAA', |
||
39 | ], |
||
40 | [ |
||
41 | new Page( Title::newFromText( 'AAA/BBB' ) ), |
||
42 | PlainPageRenderer::PATH_FULL, |
||
43 | 'AAA/BBB', |
||
44 | ], |
||
45 | [ |
||
46 | new Page( Title::newFromText( 'Foo:Bar' ) ), |
||
47 | PlainPageRenderer::PATH_FULL, |
||
48 | 'Foo:Bar', |
||
49 | ], |
||
50 | [ |
||
51 | new Page( Title::newFromText( 'Foo:Bar/Baz' ) ), |
||
52 | PlainPageRenderer::PATH_FULL, |
||
53 | 'Foo:Bar/Baz', |
||
54 | ], |
||
55 | |||
56 | |||
57 | [ |
||
58 | new Page( Title::newFromText( 'AAA' ) ), |
||
59 | PlainPageRenderer::PATH_NONE, |
||
60 | 'AAA', |
||
61 | ], |
||
62 | [ |
||
63 | new Page( Title::newFromText( 'AAA/BBB' ) ), |
||
64 | PlainPageRenderer::PATH_NONE, |
||
65 | 'BBB', |
||
66 | ], |
||
67 | [ |
||
68 | new Page( Title::newFromText( 'Foo:Bar' ) ), |
||
69 | PlainPageRenderer::PATH_NONE, |
||
70 | 'Bar', |
||
71 | ], |
||
72 | [ |
||
73 | new Page( Title::newFromText( 'Foo:Bar/Baz' ) ), |
||
74 | PlainPageRenderer::PATH_NONE, |
||
75 | 'Baz', |
||
76 | ], |
||
77 | |||
78 | |||
79 | [ |
||
80 | new Page( Title::newFromText( 'AAA' ) ), |
||
81 | PlainPageRenderer::PATH_NO_NS, |
||
82 | 'AAA', |
||
83 | ], |
||
84 | [ |
||
85 | new Page( Title::newFromText( 'AAA/BBB' ) ), |
||
86 | PlainPageRenderer::PATH_FULL, |
||
87 | 'AAA/BBB', |
||
88 | ], |
||
89 | [ |
||
90 | new Page( Title::newFromText( 'Foo:Bar' ) ), |
||
91 | PlainPageRenderer::PATH_NO_NS, |
||
92 | 'Bar', |
||
93 | ], |
||
94 | [ |
||
95 | new Page( Title::newFromText( 'Foo:Bar/Baz' ) ), |
||
96 | PlainPageRenderer::PATH_NO_NS, |
||
97 | 'Bar/Baz', |
||
98 | ], |
||
99 | |||
100 | |||
101 | [ |
||
102 | new Page( Title::newFromText( 'AAA' ) ), |
||
103 | PlainPageRenderer::PATH_SUB_PAGE, |
||
104 | 'AAA', |
||
105 | ], |
||
106 | [ |
||
107 | new Page( Title::newFromText( 'AAA/BBB' ) ), |
||
108 | PlainPageRenderer::PATH_SUB_PAGE, |
||
109 | 'BBB', |
||
110 | ], |
||
111 | [ |
||
112 | new Page( Title::newFromText( 'Foo:Bar' ) ), |
||
113 | PlainPageRenderer::PATH_SUB_PAGE, |
||
114 | 'Foo:Bar', |
||
115 | ], |
||
116 | [ |
||
117 | new Page( Title::newFromText( 'Foo:Bar/Baz' ) ), |
||
118 | PlainPageRenderer::PATH_SUB_PAGE, |
||
119 | 'Baz', |
||
120 | ], |
||
121 | ]; |
||
122 | } |
||
123 | |||
125 |