Conditions | 1 |
Paths | 1 |
Total Lines | 116 |
Code Lines | 95 |
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 |
||
34 | protected function configure() |
||
35 | { |
||
36 | $this |
||
37 | ->setDescription('Will create or update a composer configuration file') |
||
38 | ->addArgument( |
||
39 | InputTransformer::ARGUMENT_PACKAGE_NAME, |
||
40 | InputArgument::REQUIRED, |
||
41 | 'Name for the composer package' |
||
42 | ) |
||
43 | ->addArgument( |
||
44 | InputTransformer::ARGUMENT_CONFIGURATION_DEST_FOLDER, |
||
45 | InputArgument::OPTIONAL, |
||
46 | 'Configuration file destination folder', |
||
47 | '.' |
||
48 | ) |
||
49 | ->addOption( |
||
50 | InputTransformer::OPTION_TYPE, |
||
51 | null, |
||
52 | InputOption::VALUE_REQUIRED, |
||
53 | 'Package type. Ex : "library" / "project"', |
||
54 | Configuration::DEFAULT_TYPE |
||
55 | ) |
||
56 | ->addOption( |
||
57 | InputTransformer::OPTION_LICENSE, |
||
58 | null, |
||
59 | InputOption::VALUE_REQUIRED, |
||
60 | 'Package license type', |
||
61 | Configuration::DEFAULT_LICENSE |
||
62 | ) |
||
63 | ->addOption( |
||
64 | InputTransformer::OPTION_PACKAGE_VERSION, |
||
65 | null, |
||
66 | InputOption::VALUE_REQUIRED, |
||
67 | 'Package version number. Ex : "X.Y.Z"', |
||
68 | Configuration::DEFAULT_VERSION |
||
69 | ) |
||
70 | ->addOption( |
||
71 | InputTransformer::OPTION_DESCRIPTION, |
||
72 | null, |
||
73 | InputOption::VALUE_REQUIRED, |
||
74 | 'Package description' |
||
75 | ) |
||
76 | ->addOption( |
||
77 | InputTransformer::OPTION_KEYWORD, |
||
78 | null, |
||
79 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
80 | 'Package keywords' |
||
81 | ) |
||
82 | ->addOption( |
||
83 | InputTransformer::OPTION_AUTHOR, |
||
84 | null, |
||
85 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
86 | 'Package authors. Format "name[#email[#role]]' |
||
87 | ) |
||
88 | ->addOption( |
||
89 | InputTransformer::OPTION_PROVIDED_PACKAGE, |
||
90 | null, |
||
91 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
92 | 'List of packages provided by this one. Ex : "package-name#version"' |
||
93 | ) |
||
94 | ->addOption( |
||
95 | InputTransformer::OPTION_SUGGESTED_PACKAGE, |
||
96 | null, |
||
97 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
98 | 'List of packages suggested by this one. Ex : "package-name#description"' |
||
99 | ) |
||
100 | ->addOption( |
||
101 | InputTransformer::OPTION_SUPPORT, |
||
102 | null, |
||
103 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
104 | 'List of package support urls. Ex : "type#url"' |
||
105 | ) |
||
106 | ->addOption( |
||
107 | InputTransformer::OPTION_AUTOLOAD_PSR0, |
||
108 | null, |
||
109 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
110 | 'List of package PSR-0 autoload. Ex : "namespace#path"' |
||
111 | ) |
||
112 | ->addOption( |
||
113 | InputTransformer::OPTION_AUTOLOAD_PSR4, |
||
114 | null, |
||
115 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
116 | 'List of package PSR-4 autoload. Ex : "namespace#path"' |
||
117 | ) |
||
118 | ->addOption( |
||
119 | InputTransformer::OPTION_AUTOLOAD_DEV_PSR0, |
||
120 | null, |
||
121 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
122 | 'List of packages PSR-0 dev autoload. Ex : "namespace#path"' |
||
123 | ) |
||
124 | ->addOption( |
||
125 | InputTransformer::OPTION_AUTOLOAD_DEV_PSR4, |
||
126 | null, |
||
127 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
128 | 'List of package PSR-4 dev autoload. Ex : "namespace#path"' |
||
129 | ) |
||
130 | ->addOption( |
||
131 | InputTransformer::OPTION_REQUIRE, |
||
132 | null, |
||
133 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
134 | 'List of required packages. Ex "vendor/package-name#~x.y"' |
||
135 | ) |
||
136 | ->addOption( |
||
137 | InputTransformer::OPTION_REQUIRE_DEV, |
||
138 | null, |
||
139 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
140 | 'List of required dev packages. Ex "vendor/package-name#~x.y"' |
||
141 | ) |
||
142 | ->addOption( |
||
143 | InputTransformer::OPTION_SCRIPT, |
||
144 | null, |
||
145 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
146 | 'List of scripts for the package. Ex : "script-name#command"' |
||
147 | ) |
||
148 | ; |
||
149 | } |
||
150 | |||
161 |