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