Conditions | 3 |
Paths | 3 |
Total Lines | 53 |
Code Lines | 41 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 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 |
||
31 | public function boot() |
||
32 | { |
||
33 | $app = $this->getContainer()->get('app'); |
||
34 | |||
35 | // onMessage plugins |
||
36 | $app->addPlugin('onMessage', 'about', "\\Sovereign\\Plugins\\onMessage\\about", 1, "Shows information about the bot and it's creator", '', null); |
||
37 | $app->addPlugin('onMessage', 'auth', "\\Sovereign\\Plugins\\onMessage\\auth", 1, 'Authenticates you against a login with certain restrictions', '<authCode>', null); |
||
38 | $app->addPlugin('onMessage', 'char', "\\Sovereign\\Plugins\\onMessage\\char", 1, 'Fetches data from EVE-KILL about a character', '<characterName>', null); |
||
39 | $app->addPlugin('onMessage', 'coinflip', "\\Sovereign\\Plugins\\onMessage\\coinflip", 1, 'Flips a coin, and gives you the results', '', null); |
||
40 | $app->addPlugin('onMessage', 'config', "\\Sovereign\\Plugins\\onMessage\\config", 1, "Lets you configure parts of the bot, but only if you're admin", '', null); |
||
41 | $app->addPlugin('onMessage', 'corp', "\\Sovereign\\Plugins\\onMessage\\corp", 1, 'Fetches data from EVE-KILL about a corporation', '<corporationName>', null); |
||
42 | $app->addPlugin('onMessage', 'eightball', "\\Sovereign\\Plugins\\onMessage\\eightball", 1, 'Shakes the eight ball, and gives you a reply', '', null); |
||
43 | $app->addPlugin('onMessage', 'eb', "\\Sovereign\\Plugins\\onMessage\\eightball", 1, 'Shakes the eight ball, and gives you a reply', '', null); |
||
44 | $app->addPlugin('onMessage', 'guilds', "\\Sovereign\\Plugins\\onMessage\\guilds", 1, 'Tells you what guilds (Server) the bot is on', '', null); |
||
45 | $app->addPlugin('onMessage', 'item', "\\Sovereign\\Plugins\\onMessage\\item", 1, 'Shows you all the information available in the database, for an item', '<itemName>', null); |
||
46 | $app->addPlugin('onMessage', 'join', "\\Sovereign\\Plugins\\onMessage\\join", 1, 'Tells you the oauth invite link', '', null); |
||
47 | $app->addPlugin('onMessage', 'meme', "\\Sovereign\\Plugins\\onMessage\\meme", 1, 'Dank memes!', '', null); |
||
48 | $app->addPlugin('onMessage', 'pc', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Global)', '<itemName>', null); |
||
49 | $app->addPlugin('onMessage', 'amarr', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Amarr)', '<itemName>', null); |
||
50 | $app->addPlugin('onMessage', 'jita', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Jita)', '<itemName>', null); |
||
51 | $app->addPlugin('onMessage', 'dodixie', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Dodixie)', '<itemName>', null); |
||
52 | $app->addPlugin('onMessage', 'hek', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Hek)', '<itemName>', null); |
||
53 | $app->addPlugin('onMessage', 'rens', "\\Sovereign\\Plugins\\onMessage\\pc", 1, 'Lets you check prices of items in EVE. (Rens)', '<itemName>', null); |
||
54 | $app->addPlugin('onMessage', 'porn', "\\Sovereign\\Plugins\\onMessage\\porn", 1, 'Returns a picture/gif from one of many Imgur categories', '<category>', null); |
||
55 | $app->addPlugin('onMessage', 'time', "\\Sovereign\\Plugins\\onMessage\\time", 1, 'Tells you the current EVE Time and time in various other timezones', '', null); |
||
56 | $app->addPlugin('onMessage', 'tq', "\\Sovereign\\Plugins\\onMessage\\tq", 1, 'Tells you the current status of Tranquility', '', null); |
||
57 | $app->addPlugin('onMessage', 'user', "\\Sovereign\\Plugins\\onMessage\\user", 1, 'Tells you discord information on a user. Including when the bot last saw them, saw them speak, and what they were last playing', '<discordName>', null); |
||
58 | $app->addPlugin('onMessage', 'wolf', "\\Sovereign\\Plugins\\onMessage\\wolf", 1, 'Asks wolframAlpha a question, and returns the result', '<question>', null); |
||
59 | $app->addPlugin('onMessage', 'help', "\\Sovereign\\Plugins\\onMessage\\help", 1, 'Shows helpful information about all the plugins available', null, null); |
||
60 | $app->addPlugin('onMessage', 'memory', "\\Sovereign\\Plugins\\onMessage\\memory", 3, 'Triggers garbage collection', null, null); |
||
61 | |||
62 | // onTimer plugins |
||
63 | $app->addPlugin('onTimer', 'memory', "\\Sovereign\\Plugins\\onTimer\\memory", 1, '', '', 1800); |
||
64 | $app->addPlugin('onTimer', 'jabberPingsTheCulture', "\\Sovereign\\Plugins\\onTimer\\jabberPingsTheCulture", 1, '', '', 5); |
||
65 | $app->addPlugin('onTimer', 'kills', "\\Sovereign\\Plugins\\onTimer\\kills", 1, '', '', 15); |
||
66 | |||
67 | // onVoice plugins |
||
68 | $app->addPlugin('onVoice', 'reapers', "\\Sovereign\\Plugins\\onVoice\\reapers", 1, 'Plays a random quote from Sovereign', '', null); |
||
69 | $app->addPlugin('onVoice', 'horn', "\\Sovereign\\Plugins\\onVoice\\horn", 1, 'Horns. Just horns..', '', null); |
||
70 | $app->addPlugin('onVoice', 'warnings', "\\Sovereign\\Plugins\\onVoice\\warnings", 1, 'Plays a random warning sound from EVE-Online', '', null); |
||
71 | $app->addPlugin('onVoice', 'unleashthe90s', "\\Sovereign\\Plugins\\onVoice\\unleashthe90s", 1, 'Plays a random 90s song', '', null); |
||
72 | $app->addPlugin('onVoice', 'radio90s', "\\Sovereign\\Plugins\\onVoice\\radio90s", 1, 'Keeps on playing 90s songs, till you go !stop', '', null); |
||
73 | $app->addPlugin('onVoice', 'radio', "\\Sovereign\\Plugins\\onVoice\\radio", 1, 'Keeps on playing a Radio station, till you go !stop', '', null); |
||
74 | |||
75 | // Attempt to register any configured service providers |
||
76 | $config = $this->getContainer()->get('config'); |
||
77 | $providers = $config->getAll('serviceproviders'); |
||
78 | if (!empty($providers)) { |
||
79 | foreach ($providers as $class) { |
||
80 | $this->getContainer()->addServiceProvider($class); |
||
81 | } |
||
82 | } |
||
83 | } |
||
84 | |||
93 |