| Total Lines | 53 |
| Code Lines | 25 |
| 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 |
||
| 24 | function () { |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Title: Make pot command. |
||
| 28 | * Description: |
||
| 29 | * Copyright: 2005-2021 Pronamic |
||
| 30 | * Company: Pronamic |
||
| 31 | * |
||
| 32 | * @author Remco Tolsma |
||
| 33 | * @version 5.5.5 |
||
| 34 | * @since 5.5.0 |
||
| 35 | */ |
||
| 36 | class MakePotCommand extends \WP_CLI\I18n\MakePotCommand { |
||
| 37 | /** |
||
| 38 | * Command constructor. |
||
| 39 | */ |
||
| 40 | public function __construct() { |
||
| 41 | parent::__construct(); |
||
| 42 | |||
| 43 | // @link https://github.com/wp-cli/i18n-command/blob/v2.0.1/src/MakePotCommand.php#L36-L44 |
||
| 44 | $this->exclude = array_diff( |
||
| 45 | $this->exclude, |
||
| 46 | array( |
||
| 47 | 'vendor', |
||
| 48 | ) |
||
| 49 | ); |
||
| 50 | |||
| 51 | $this->exclude = array_merge( |
||
| 52 | $this->exclude, |
||
| 53 | array( |
||
| 54 | 'build', |
||
| 55 | 'deploy', |
||
| 56 | 'documentation', |
||
| 57 | 'etc', |
||
| 58 | 'repositories', |
||
| 59 | 'wordpress', |
||
| 60 | 'wp-content', |
||
| 61 | ) |
||
| 62 | ); |
||
| 63 | |||
| 64 | $this->include = array( |
||
| 65 | 'admin', |
||
| 66 | 'includes', |
||
| 67 | 'templates', |
||
| 68 | 'vendor', |
||
| 69 | 'views', |
||
| 70 | '*.php', |
||
| 71 | ); |
||
| 72 | } |
||
| 73 | } |
||
| 74 | |||
| 75 | // @link https://github.com/wp-cli/i18n-command/blob/v2.0.1/i18n-command.php |
||
| 76 | \WP_CLI::add_command( 'pronamic i18n make-pot', '\Pronamic\WordPress\Pay\MakePotCommand' ); |
||
| 77 | |||
| 85 |