Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Code Lines | 38 |
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 |
||
60 | public function configure(Command $command): void |
||
61 | { |
||
62 | $command->setName('list'); |
||
63 | $command->setDescription('List donors'); |
||
64 | $command->setHelp('List donors in database'); |
||
65 | |||
66 | $command->addOption( |
||
67 | 'filter', |
||
68 | null, |
||
69 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
70 | sprintf( |
||
71 | 'Use donor filter, possible values: %s', |
||
72 | implode(", ", $this->filterCollection->getItemKeys()) |
||
73 | ) |
||
74 | ); |
||
75 | |||
76 | $command->addOption( |
||
77 | 'filter-not', |
||
78 | null, |
||
79 | InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, |
||
80 | sprintf( |
||
81 | 'Use negated filter, possible values: %s', |
||
82 | implode(", ", $this->filterCollection->getItemKeys()) |
||
83 | ) |
||
84 | ); |
||
85 | |||
86 | $command->addOption( |
||
87 | 'sorter', |
||
88 | null, |
||
89 | InputOption::VALUE_REQUIRED, |
||
90 | sprintf( |
||
91 | 'Set donor sorter, possible values: %s', |
||
92 | implode(", ", $this->sorterCollection->getItemKeys()) |
||
93 | ), |
||
94 | '' |
||
95 | ); |
||
96 | |||
97 | $command->addOption( |
||
98 | 'desc', |
||
99 | null, |
||
100 | InputOption::VALUE_NONE, |
||
101 | 'Sort donors in descending order' |
||
102 | ); |
||
103 | |||
104 | $command->addOption( |
||
105 | 'format', |
||
106 | null, |
||
107 | InputOption::VALUE_REQUIRED, |
||
108 | sprintf( |
||
109 | 'Set output format, possible values: %s', |
||
110 | implode(", ", $this->formatterCollection->getItemKeys()) |
||
111 | ), |
||
112 | 'list' |
||
113 | ); |
||
145 |