Conditions | 1 |
Paths | 1 |
Total Lines | 55 |
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 |
||
53 | public function dataProviderSubobjectTest() |
||
54 | { |
||
55 | $provider = [ |
||
56 | [ |
||
57 | [ [] ], |
||
58 | [ 1 => true ] |
||
59 | ], |
||
60 | [ |
||
61 | [ null ], |
||
62 | [ 1 => true ] |
||
63 | ], |
||
64 | [ |
||
65 | [ '' ], |
||
66 | [ 1 => true ] |
||
67 | ], |
||
68 | [ |
||
69 | [ [ 'has text=test', 'Is bool=true' ] ], |
||
70 | [ 1 => true ] |
||
71 | ], |
||
72 | [ |
||
73 | [ [ 'has type=test', 'Is bool=true' ] ], |
||
74 | [ [ 1 => false, 'error' => wfMessage('smw-datavalue-property-restricted-declarative-use', 'Has type')->inLanguage('en')->plain() ] ] |
||
75 | ], |
||
76 | [ |
||
77 | [ [ 'has text=test', 'Is bool=true','1215623e790d918773db943232068a93b21c9f1419cb85666c6558e87f5b7d47=test' ] ], |
||
78 | [ 1 => true ] |
||
79 | ], |
||
80 | [ |
||
81 | [ [], '01234567890_testStringAsId' ], |
||
82 | [ 1 => true ] |
||
83 | ], |
||
84 | [ |
||
85 | [ null, '01234567890_testStringAsId' ], |
||
86 | [ 1 => true ] |
||
87 | ], |
||
88 | [ |
||
89 | [ '', '01234567890_testStringAsId' ], |
||
90 | [ 1 => true ] |
||
91 | ], |
||
92 | [ |
||
93 | [ [ 'has text=test', 'Is bool=true' ], '01234567890_testStringAsId' ], |
||
94 | [ 1 => true ] |
||
95 | ], |
||
96 | [ |
||
97 | [ [ 'has type=test', 'Allows value=test' ], '01234567890_testStringAsId' ], |
||
98 | [ [ 1 => false, 'error' => '<ul><li>' . wfMessage('smw-datavalue-property-restricted-declarative-use', 'Has type')->inLanguage('en')->plain() . '</li> <!--br--><li>' . wfMessage('smw-datavalue-property-restricted-declarative-use', 'Allows value')->inLanguage('en')->plain() . '</li></ul>' ] ] |
||
99 | ], |
||
100 | [ |
||
101 | [ [ 'has text=test', 'Is bool=true' => 'test','1215623e790d918773db943232068a93b21c9f1419cb85666c6558e87f5b7d47=test' ], '01234567890_testStringAsId' ], |
||
102 | [ 1 => true ] |
||
103 | ], |
||
104 | ]; |
||
105 | |||
106 | return $provider; |
||
107 | } |
||
108 | } |