Conditions | 2 |
Paths | 2 |
Total Lines | 54 |
Code Lines | 32 |
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 execute(InputInterface $input, OutputInterface $output) |
||
41 | { |
||
42 | /** @var SlackBot $slackBot */ |
||
43 | $slackBot = $this->getContainer()->get('wowapps.slackbot'); |
||
44 | $slackBotConfig = $slackBot->getConfig(); |
||
45 | |||
46 | $symfonyStyle = new SymfonyStyle($input, $output); |
||
47 | |||
48 | echo PHP_EOL; |
||
49 | $output->writeln('<bg=blue;options=bold;fg=white> </>'); |
||
50 | $output->writeln('<bg=blue;options=bold;fg=white> S L A C K B O T T E S T </>'); |
||
51 | $output->writeln('<bg=blue;options=bold;fg=white> </>'); |
||
52 | echo PHP_EOL; |
||
53 | |||
54 | $symfonyStyle->section('SlackBot general settings'); |
||
55 | |||
56 | $symfonyStyle->table( |
||
57 | ['api url'], |
||
58 | [[$slackBotConfig['api_url']]] |
||
59 | ); |
||
60 | |||
61 | $symfonyStyle->table( |
||
62 | ['default icon'], |
||
63 | [[$slackBotConfig['default_icon']]] |
||
64 | ); |
||
65 | |||
66 | $symfonyStyle->table( |
||
67 | ['default recipient'], |
||
68 | [[$slackBotConfig['default_channel']]] |
||
69 | ); |
||
70 | |||
71 | $symfonyStyle->section('SlackBot quote colors'); |
||
72 | |||
73 | $symfonyStyle->table( |
||
74 | ['default', 'info', 'warning', 'success', 'danger'], |
||
75 | [ |
||
76 | [ |
||
77 | $slackBotConfig['quote_color']['default'], |
||
78 | $slackBotConfig['quote_color']['info'], |
||
79 | $slackBotConfig['quote_color']['warning'], |
||
80 | $slackBotConfig['quote_color']['success'], |
||
81 | $slackBotConfig['quote_color']['danger'] |
||
82 | ] |
||
83 | ] |
||
84 | ); |
||
85 | |||
86 | $symfonyStyle->section('Sending short message...'); |
||
87 | |||
88 | if ($this->sendTestMessage($slackBot)) { |
||
89 | $symfonyStyle->success('Message sent successfully'); |
||
90 | } else { |
||
91 | $symfonyStyle->error('Message not sent'); |
||
92 | } |
||
93 | } |
||
94 | |||
127 |