| Conditions | 1 |
| Paths | 1 |
| Total Lines | 122 |
| Code Lines | 96 |
| 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 |
||
| 40 | protected function configure() |
||
| 41 | { |
||
| 42 | $this |
||
| 43 | ->setDescription('Will update a composer configuration file.') |
||
| 44 | // @codingStandardsIgnoreStart |
||
| 45 | ->setHelp(<<<DESC |
||
| 46 | - <info>keywords</info> will be appended to existing ones |
||
| 47 | - <info>other plain values</info> (package name, version, ...) will replace old ones if they are already present, else they will be added |
||
| 48 | - <info>nested values</info> (authors, autoload, script, ...) will replace old ones if they are already present, else they will be appended |
||
| 49 | DESC |
||
| 50 | ) |
||
| 51 | // @codingStandardsIgnoreEnd |
||
| 52 | ->addArgument( |
||
| 53 | self::ARGUMENT_CONFIGURATION_DEST_FOLDER, |
||
| 54 | InputArgument::OPTIONAL, |
||
| 55 | 'Existing onfiguration file path', |
||
| 56 | '.' |
||
| 57 | ) |
||
| 58 | ->addOption( |
||
| 59 | InputTransformer::KEY_PACKAGE_NAME, |
||
| 60 | null, |
||
| 61 | InputOption::VALUE_REQUIRED, |
||
| 62 | 'Name for the composer package' |
||
| 63 | ) |
||
| 64 | ->addOption( |
||
| 65 | InputTransformer::KEY_TYPE, |
||
| 66 | null, |
||
| 67 | InputOption::VALUE_REQUIRED, |
||
| 68 | 'Package type. Ex : "library" / "project"' |
||
| 69 | ) |
||
| 70 | ->addOption( |
||
| 71 | InputTransformer::KEY_LICENSE, |
||
| 72 | null, |
||
| 73 | InputOption::VALUE_REQUIRED, |
||
| 74 | 'Package license type' |
||
| 75 | ) |
||
| 76 | ->addOption( |
||
| 77 | InputTransformer::KEY_PACKAGE_VERSION, |
||
| 78 | null, |
||
| 79 | InputOption::VALUE_REQUIRED, |
||
| 80 | 'Package version number. Ex : "X.Y.Z"' |
||
| 81 | ) |
||
| 82 | ->addOption( |
||
| 83 | InputTransformer::KEY_DESCRIPTION, |
||
| 84 | null, |
||
| 85 | InputOption::VALUE_REQUIRED, |
||
| 86 | 'Package description' |
||
| 87 | ) |
||
| 88 | ->addOption( |
||
| 89 | InputTransformer::KEY_KEYWORD, |
||
| 90 | null, |
||
| 91 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 92 | 'Package keywords' |
||
| 93 | ) |
||
| 94 | ->addOption( |
||
| 95 | InputTransformer::KEY_AUTHOR, |
||
| 96 | null, |
||
| 97 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 98 | 'Package authors. Format "name[#email[#role]]' |
||
| 99 | ) |
||
| 100 | ->addOption( |
||
| 101 | InputTransformer::KEY_PROVIDED_PACKAGE, |
||
| 102 | null, |
||
| 103 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 104 | 'List of packages provided by this one. Ex : "package-name#version"' |
||
| 105 | ) |
||
| 106 | ->addOption( |
||
| 107 | InputTransformer::KEY_SUGGESTED_PACKAGE, |
||
| 108 | null, |
||
| 109 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 110 | 'List of packages suggested by this one. Ex : "package-name#description"' |
||
| 111 | ) |
||
| 112 | ->addOption( |
||
| 113 | InputTransformer::KEY_SUPPORT, |
||
| 114 | null, |
||
| 115 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 116 | 'List of package support urls. Ex : "type#url"' |
||
| 117 | ) |
||
| 118 | ->addOption( |
||
| 119 | InputTransformer::KEY_AUTOLOAD_PSR0, |
||
| 120 | null, |
||
| 121 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 122 | 'List of package PSR-0 autoload. Ex : "namespace#path"' |
||
| 123 | ) |
||
| 124 | ->addOption( |
||
| 125 | InputTransformer::KEY_AUTOLOAD_PSR4, |
||
| 126 | null, |
||
| 127 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 128 | 'List of package PSR-4 autoload. Ex : "namespace#path"' |
||
| 129 | ) |
||
| 130 | ->addOption( |
||
| 131 | InputTransformer::KEY_AUTOLOAD_DEV_PSR0, |
||
| 132 | null, |
||
| 133 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 134 | 'List of packages PSR-0 dev autoload. Ex : "namespace#path"' |
||
| 135 | ) |
||
| 136 | ->addOption( |
||
| 137 | InputTransformer::KEY_AUTOLOAD_DEV_PSR4, |
||
| 138 | null, |
||
| 139 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 140 | 'List of package PSR-4 dev autoload. Ex : "namespace#path"' |
||
| 141 | ) |
||
| 142 | ->addOption( |
||
| 143 | InputTransformer::KEY_REQUIRE, |
||
| 144 | null, |
||
| 145 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 146 | 'List of required packages. Ex "vendor/package-name#~x.y"' |
||
| 147 | ) |
||
| 148 | ->addOption( |
||
| 149 | InputTransformer::KEY_REQUIRE_DEV, |
||
| 150 | null, |
||
| 151 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 152 | 'List of required dev packages. Ex "vendor/package-name#~x.y"' |
||
| 153 | ) |
||
| 154 | ->addOption( |
||
| 155 | InputTransformer::KEY_SCRIPT, |
||
| 156 | null, |
||
| 157 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
| 158 | 'List of scripts for the package. Ex : "script-name#command"' |
||
| 159 | ) |
||
| 160 | ; |
||
| 161 | } |
||
| 162 | |||
| 181 |