| Conditions | 1 |
| Paths | 1 |
| Total Lines | 90 |
| Code Lines | 60 |
| 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 |
||
| 72 | public function provideOptions(): Generator |
||
| 73 | { |
||
| 74 | yield [ |
||
| 75 | ['cli.php', '--foo'], |
||
| 76 | self::getDefaultInteractive(), |
||
| 77 | IO::VERBOSITY_NORMAL, |
||
| 78 | ]; |
||
| 79 | |||
| 80 | yield [ |
||
| 81 | ['cli.php', '--foo', '--verbose=0'], |
||
| 82 | self::getDefaultInteractive(), |
||
| 83 | IO::VERBOSITY_VERBOSE, |
||
| 84 | ]; |
||
| 85 | |||
| 86 | yield [ |
||
| 87 | ['cli.php', '--foo', '--quiet'], |
||
| 88 | false, |
||
| 89 | IO::VERBOSITY_QUIET, |
||
| 90 | ]; |
||
| 91 | |||
| 92 | yield [ |
||
| 93 | ['cli.php', '--foo', '-q'], |
||
| 94 | false, |
||
| 95 | IO::VERBOSITY_QUIET, |
||
| 96 | ]; |
||
| 97 | |||
| 98 | yield [ |
||
| 99 | ['cli.php', '--foo', '-vvv'], |
||
| 100 | self::getDefaultInteractive(), |
||
| 101 | IO::VERBOSITY_DEBUG, |
||
| 102 | ]; |
||
| 103 | |||
| 104 | yield [ |
||
| 105 | ['cli.php', '--foo', '--verbose=3'], |
||
| 106 | self::getDefaultInteractive(), |
||
| 107 | IO::VERBOSITY_DEBUG, |
||
| 108 | ]; |
||
| 109 | |||
| 110 | yield [ |
||
| 111 | ['cli.php', '--foo', '--verbose 3'], |
||
| 112 | self::getDefaultInteractive(), |
||
| 113 | IO::VERBOSITY_DEBUG, |
||
| 114 | ]; |
||
| 115 | |||
| 116 | yield [ |
||
| 117 | ['cli.php', '--foo', '-vv'], |
||
| 118 | self::getDefaultInteractive(), |
||
| 119 | IO::VERBOSITY_VERY_VERBOSE, |
||
| 120 | ]; |
||
| 121 | |||
| 122 | yield [ |
||
| 123 | ['cli.php', '--foo', '--verbose=2'], |
||
| 124 | self::getDefaultInteractive(), |
||
| 125 | IO::VERBOSITY_VERY_VERBOSE, |
||
| 126 | ]; |
||
| 127 | |||
| 128 | yield [ |
||
| 129 | ['cli.php', '--foo', '--verbose 2'], |
||
| 130 | self::getDefaultInteractive(), |
||
| 131 | IO::VERBOSITY_VERY_VERBOSE, |
||
| 132 | ]; |
||
| 133 | |||
| 134 | yield [ |
||
| 135 | ['cli.php', '--foo', '-v'], |
||
| 136 | self::getDefaultInteractive(), |
||
| 137 | IO::VERBOSITY_VERBOSE, |
||
| 138 | ]; |
||
| 139 | |||
| 140 | yield [ |
||
| 141 | ['cli.php', '--foo', '--verbose=1'], |
||
| 142 | self::getDefaultInteractive(), |
||
| 143 | IO::VERBOSITY_VERBOSE, |
||
| 144 | ]; |
||
| 145 | |||
| 146 | yield [ |
||
| 147 | ['cli.php', '--foo', '--verbose '], |
||
| 148 | self::getDefaultInteractive(), |
||
| 149 | IO::VERBOSITY_VERBOSE, |
||
| 150 | ]; |
||
| 151 | |||
| 152 | yield [ |
||
| 153 | ['cli.php', '--no-interaction'], |
||
| 154 | false, |
||
| 155 | IO::VERBOSITY_NORMAL, |
||
| 156 | ]; |
||
| 157 | |||
| 158 | yield [ |
||
| 159 | ['cli.php', '-n'], |
||
| 160 | false, |
||
| 161 | IO::VERBOSITY_NORMAL, |
||
| 162 | ]; |
||
| 203 |