Conditions | 1 |
Paths | 1 |
Total Lines | 104 |
Code Lines | 81 |
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 |
||
44 | public function provideCommandData(): iterable |
||
45 | { |
||
46 | return array( |
||
47 | 'sync with en' => array( |
||
48 | 'en', |
||
49 | array('messages' => array('foo' => 'bar')), |
||
50 | 'fr', |
||
51 | array('messages' => array('foo' => 'baz')), |
||
52 | array('locale' => 'fr'), |
||
53 | 0, |
||
54 | 'The fr catalogue is in sync with the en one.', |
||
55 | ), |
||
56 | 'sync with en explicit' => array( |
||
57 | 'en', |
||
58 | array('messages' => array('foo' => 'bar'), 'test' => array('me' => 'Me')), |
||
59 | 'fr', |
||
60 | array('messages' => array('foo' => 'baz'), 'test' => array('me' => 'Moi')), |
||
61 | array('locale' => 'fr', 'source' => 'en'), |
||
62 | 0, |
||
63 | 'The fr catalogue is in sync with the en one.', |
||
64 | OutputInterface::VERBOSITY_VERBOSE, |
||
65 | ), |
||
66 | 'missing message' => array( |
||
67 | 'en', |
||
68 | array('messages' => array('foo' => 'bar')), |
||
69 | 'fr', |
||
70 | array('messages' => array()), |
||
71 | array('locale' => 'fr'), |
||
72 | 1, |
||
73 | '1 messages are missing in the messages domain', |
||
74 | ), |
||
75 | 'missing message verbose' => array( |
||
76 | 'en', |
||
77 | array('messages' => array('foo' => 'bar')), |
||
78 | 'fr', |
||
79 | array('messages' => array()), |
||
80 | array('locale' => 'fr'), |
||
81 | 1, |
||
82 | array('1 messages are missing in the messages domain', ' foo'), |
||
83 | OutputInterface::VERBOSITY_VERBOSE, |
||
84 | ), |
||
85 | 'obsolete message' => array( |
||
86 | 'en', |
||
87 | array('messages' => array('foo' => 'bar')), |
||
88 | 'fr', |
||
89 | array('messages' => array('foo' => 'bar', 'bar' => 'baz', 'old' => 'one')), |
||
90 | array('locale' => 'fr'), |
||
91 | 1, |
||
92 | '2 messages are obsolete in the messages domain', |
||
93 | ), |
||
94 | 'obsolete message verbose' => array( |
||
95 | 'en', |
||
96 | array('messages' => array('foo' => 'bar')), |
||
97 | 'fr', |
||
98 | array('messages' => array('foo' => 'bar', 'bar' => 'baz', 'old.key' => 'one')), |
||
99 | array('locale' => 'fr'), |
||
100 | 1, |
||
101 | array('2 messages are obsolete in the messages domain', ' bar', ' old.key'), |
||
102 | OutputInterface::VERBOSITY_VERBOSE, |
||
103 | ), |
||
104 | 'missing and obsolete message' => array( |
||
105 | 'en', |
||
106 | array('messages' => array('foo' => 'bar'), 'test' => array('hello' => 'world')), |
||
107 | 'fr', |
||
108 | array('messages' => array('foo' => 'bar', 'bar' => 'baz', 'old' => 'one')), |
||
109 | array('locale' => 'fr'), |
||
110 | 1, |
||
111 | array('2 messages are obsolete in the messages domain', '1 messages are missing in the test domain'), |
||
112 | ), |
||
113 | 'domain restriction sync' => array( |
||
114 | 'en', |
||
115 | array('messages' => array('foo' => 'bar'), 'test' => array('foo' => 'bar')), |
||
116 | 'fr', |
||
117 | array('messages' => array('foo' => 'baz')), |
||
118 | array('locale' => 'fr', '--domain' => array('messages', 'other')), |
||
119 | 0, |
||
120 | array('The fr catalogue is in sync with the en one.', 'Checking the domains messages'), |
||
121 | ), |
||
122 | 'domain restriction missing' => array( |
||
123 | 'en', |
||
124 | array('messages' => array('foo' => 'bar'), 'test' => array('foo' => 'bar')), |
||
125 | 'fr', |
||
126 | array('messages' => array('foo' => 'baz'), 'other' => array('hello' => 'world')), |
||
127 | array('locale' => 'fr', '--domain' => array('test', 'other')), |
||
128 | 1, |
||
129 | array('1 messages are missing in the test domain', 'Checking the domains other, test'), |
||
130 | ), |
||
131 | 'missing and obsolete message with obsolete only' => array( |
||
132 | 'en', |
||
133 | array('messages' => array('foo' => 'bar'), 'test' => array('hello' => 'world')), |
||
134 | 'fr', |
||
135 | array('messages' => array('foo' => 'bar', 'bar' => 'baz', 'old' => 'one')), |
||
136 | array('locale' => 'fr', '--obsolete-only' => true), |
||
137 | 1, |
||
138 | array('2 messages are obsolete in the messages domain'), |
||
139 | ), |
||
140 | 'missing message with obsolete only' => array( |
||
141 | 'en', |
||
142 | array('messages' => array('foo' => 'bar')), |
||
143 | 'fr', |
||
144 | array('messages' => array()), |
||
145 | array('locale' => 'fr', '--obsolete-only' => true), |
||
146 | 0, |
||
147 | 'The fr catalogue is in sync with the en one.', |
||
148 | ), |
||
240 |