@@ -17,6 +17,9 @@ |
||
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $sentence |
|
22 | + */ |
|
20 | 23 | public function answer($sentence) { |
21 | 24 | foreach(JarvisBehaviourLanguage::$jbl_set->rules as $rule) { |
22 | 25 | foreach($rule->matches as $match) { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | /** |
84 | 84 | * Is it the right plugin for the command? |
85 | 85 | * @param string $command |
86 | - * @return boolean |
|
86 | + * @return integer |
|
87 | 87 | */ |
88 | 88 | function isLikely($command) { |
89 | 89 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Returns an authorized API client. |
102 | - * @return Google_Client the authorized client object |
|
102 | + * @return null|\Google_Client the authorized client object |
|
103 | 103 | */ |
104 | 104 | function getClient() { |
105 | 105 | $client = new \Google_Client(); |
@@ -39,7 +39,9 @@ |
||
39 | 39 | // Get the API client and construct the service object. |
40 | 40 | $client = Gcalendar_plugin::getClient(); |
41 | 41 | |
42 | - if($client==null) return null; |
|
42 | + if($client==null) { |
|
43 | + return null; |
|
44 | + } |
|
43 | 45 | |
44 | 46 | $service = new \Google_Service_Calendar($client); |
45 | 47 |
@@ -86,7 +86,7 @@ |
||
86 | 86 | /** |
87 | 87 | * Is it the right plugin for the command? |
88 | 88 | * @param string $command |
89 | - * @return boolean |
|
89 | + * @return integer |
|
90 | 90 | */ |
91 | 91 | function isLikely($command) { |
92 | 92 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
@@ -63,8 +63,7 @@ |
||
63 | 63 | if(!$result) { |
64 | 64 | JarvisPHP::getLogger()->error('Curl error: '.curl_error($ch)); |
65 | 65 | $answer = JarvisLanguage::translate('command_not_sent',get_called_class()); |
66 | - } |
|
67 | - else { |
|
66 | + } else { |
|
68 | 67 | $answer = JarvisLanguage::translate('command_sent_to_light_switch',get_called_class()); |
69 | 68 | } |
70 | 69 |
@@ -8,6 +8,9 @@ |
||
8 | 8 | */ |
9 | 9 | class GenericCurl { |
10 | 10 | |
11 | + /** |
|
12 | + * @param string $url |
|
13 | + */ |
|
11 | 14 | static function exec($url, $fields) { |
12 | 15 | |
13 | 16 |
@@ -9,6 +9,9 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class TelegramBotApiWrapper { |
11 | 11 | |
12 | + /** |
|
13 | + * @param resource $handle |
|
14 | + */ |
|
12 | 15 | function exec_curl_request($handle) { |
13 | 16 | $response = curl_exec($handle); |
14 | 17 | |
@@ -45,6 +48,9 @@ discard block |
||
45 | 48 | return $response; |
46 | 49 | } |
47 | 50 | |
51 | + /** |
|
52 | + * @param string $method |
|
53 | + */ |
|
48 | 54 | function apiRequestJson($method, $parameters) { |
49 | 55 | if (!is_string($method)) { |
50 | 56 | echo("Method name must be a string\n"); |
@@ -30,8 +30,7 @@ |
||
30 | 30 | if($hour>5 && $hour<=13) { |
31 | 31 | //Morning |
32 | 32 | $answer = JarvisLanguage::translate('hello_morning',get_called_class()); |
33 | - } |
|
34 | - else if($hour>13 && $hour<18) { |
|
33 | + } else if($hour>13 && $hour<18) { |
|
35 | 34 | //Afternoon |
36 | 35 | $answer = JarvisLanguage::translate('hello_afternoon',get_called_class()); |
37 | 36 | } else { |
@@ -86,7 +86,7 @@ |
||
86 | 86 | /** |
87 | 87 | * Is it the right plugin for the command? |
88 | 88 | * @param string $command |
89 | - * @return boolean |
|
89 | + * @return integer |
|
90 | 90 | */ |
91 | 91 | function isLikely($command) { |
92 | 92 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
@@ -52,8 +52,7 @@ discard block |
||
52 | 52 | //Error handling |
53 | 53 | JarvisPHP::getLogger()->warn('Failed to connect!'); |
54 | 54 | $answer = 'Failed to connect!'; |
55 | - } |
|
56 | - else { |
|
55 | + } else { |
|
57 | 56 | $vlc_remote_command = 'stop'.chr(13); |
58 | 57 | $vlc_remote_command = 'quit'.chr(13); |
59 | 58 | socket_write($socket, $vlc_remote_command, strlen($vlc_remote_command)); |
@@ -75,8 +74,7 @@ discard block |
||
75 | 74 | //Error handling |
76 | 75 | JarvisPHP::getLogger()->warn('Failed to connect!'); |
77 | 76 | $answer = 'Failed to connect!'; |
78 | - } |
|
79 | - else { |
|
77 | + } else { |
|
80 | 78 | $vlc_remote_command = 'add '.$stream_url.chr(13); |
81 | 79 | socket_write($socket, $vlc_remote_command, strlen($vlc_remote_command)); |
82 | 80 | socket_close($socket); |
@@ -86,7 +86,7 @@ |
||
86 | 86 | /** |
87 | 87 | * Is it the right plugin for the command? |
88 | 88 | * @param string $command |
89 | - * @return boolean |
|
89 | + * @return integer |
|
90 | 90 | */ |
91 | 91 | function isLikely($command) { |
92 | 92 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |
@@ -116,8 +116,7 @@ discard block |
||
116 | 116 | JarvisLanguage::loadPluginTranslation($plugin_class); |
117 | 117 | $plugin = new $plugin_class(); |
118 | 118 | $plugin->answer($command); |
119 | - } |
|
120 | - else { |
|
119 | + } else { |
|
121 | 120 | //Clear all session variable |
122 | 121 | JarvisSession::reset(); |
123 | 122 | JarvisPHP::getLogger()->debug('Active session not detected or expired'); |
@@ -147,8 +146,7 @@ discard block |
||
147 | 146 | JarvisTTS::speak(JarvisLanguage::translate('response_to_magic_words_to_stop_session')); |
148 | 147 | $response = new \JarvisPHP\Core\JarvisResponse(JarvisLanguage::translate('response_to_magic_words_to_stop_session')); |
149 | 148 | $response->send(); |
150 | - } |
|
151 | - else { |
|
149 | + } else { |
|
152 | 150 | JarvisBehaviourLanguage::loadBehaviourLanguage(); |
153 | 151 | $answer = JarvisBehaviourLanguage::answer($command); |
154 | 152 | if($answer) { |
@@ -86,7 +86,7 @@ |
||
86 | 86 | /** |
87 | 87 | * Is it the right plugin for the command? |
88 | 88 | * @param string $command |
89 | - * @return boolean |
|
89 | + * @return integer |
|
90 | 90 | */ |
91 | 91 | function isLikely($command) { |
92 | 92 | return preg_match(JarvisLanguage::translate('preg_match_activate_plugin',get_called_class()), $command); |