Conditions | 5 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | function answer($command) { |
||
27 | $answer = ''; |
||
28 | JarvisPHP::getLogger()->debug('Answering to command: "'.$command.'"'); |
||
29 | $hour = date("H"); |
||
30 | if($hour>5 && $hour<=13) { |
||
31 | //Morning |
||
32 | $answer = JarvisLanguage::translate('hello_morning',get_called_class()); |
||
33 | } |
||
34 | else if($hour>13 && $hour<18) { |
||
35 | //Afternoon |
||
36 | $answer = JarvisLanguage::translate('hello_afternoon',get_called_class()); |
||
37 | } else { |
||
38 | //Evening (and night, of course) |
||
39 | $answer = JarvisLanguage::translate('hello_evening',get_called_class()); |
||
40 | } |
||
41 | |||
42 | |||
43 | JarvisTTS::speak($answer); |
||
44 | $response = new \JarvisPHP\Core\JarvisResponse($answer, JarvisPHP::getRealClassName(get_called_class()), true); |
||
45 | $response->send(); |
||
46 | } |
||
47 | |||
73 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.