Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Code Lines | 43 |
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 |
||
14 | protected function configure() |
||
15 | { |
||
16 | $this |
||
17 | ->setName('install') |
||
18 | ->setDescription('Install a PHP Class as Linux Daemon') |
||
19 | ->addOption( |
||
20 | 'template', |
||
21 | 't', |
||
22 | InputOption::VALUE_REQUIRED, |
||
23 | 'Defines the default service template -- initd or upstart', |
||
24 | 'initd' |
||
25 | ) |
||
26 | ->addOption( |
||
27 | 'no-check', |
||
28 | 'nc', |
||
29 | InputOption::VALUE_NONE, |
||
30 | 'No check for path or file errors. Just install. ', |
||
31 | true |
||
32 | ) |
||
33 | ->addArgument( |
||
34 | 'servicename', |
||
35 | InputArgument::REQUIRED, |
||
36 | 'The unix service name.' |
||
37 | ) |
||
38 | ->addArgument( |
||
39 | 'classname', |
||
40 | InputArgument::REQUIRED, |
||
41 | 'The PHP class and method like ClassName::Method' |
||
42 | ) |
||
43 | ->addArgument( |
||
44 | 'bootstrap', |
||
45 | InputArgument::OPTIONAL, |
||
46 | 'The relative path from root directory for the bootstrap file, like vendor/autoload.php', |
||
47 | 'vendor/autoload.php' |
||
48 | ) |
||
49 | ->addArgument( |
||
50 | 'rootdir', |
||
51 | InputArgument::OPTIONAL, |
||
52 | 'The root path where your application is installed', |
||
53 | getcwd() . "/" |
||
54 | ) |
||
55 | ->addArgument( |
||
56 | 'description', |
||
57 | InputArgument::OPTIONAL, |
||
58 | 'is an optional service description', |
||
59 | "Daemon generated by Daemonize" |
||
60 | ) |
||
61 | ->addArgument( |
||
62 | 'args', |
||
63 | InputArgument::IS_ARRAY, |
||
64 | 'is an optional arguments for your class' |
||
65 | ); |
||
66 | } |
||
67 | |||
82 |