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