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