stwalkerster /
waca
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Waca\Router; |
||
| 4 | |||
| 5 | use Exception; |
||
| 6 | use Waca\API\Actions\CountAction; |
||
| 7 | use Waca\API\Actions\HelpAction; |
||
| 8 | use Waca\API\Actions\MonitorAction; |
||
| 9 | use Waca\API\Actions\StatsAction; |
||
| 10 | use Waca\API\Actions\StatusAction; |
||
| 11 | use Waca\API\Actions\UnknownAction; |
||
| 12 | use Waca\Tasks\IRoutedTask; |
||
| 13 | use Waca\WebRequest; |
||
| 14 | |||
| 15 | class ApiRequestRouter implements IRequestRouter |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @return string[] |
||
| 19 | */ |
||
| 20 | public static function getActionList() |
||
| 21 | { |
||
| 22 | return array("count", "status", "stats", "help", "monitor"); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @return IRoutedTask |
||
|
0 ignored issues
–
show
|
|||
| 27 | * @throws Exception |
||
| 28 | */ |
||
| 29 | public function route() |
||
| 30 | { |
||
| 31 | $requestAction = WebRequest::getString('action'); |
||
| 32 | |||
| 33 | switch ($requestAction) { |
||
| 34 | case "count": |
||
| 35 | $result = new CountAction(); |
||
| 36 | break; |
||
| 37 | case "status": |
||
| 38 | $result = new StatusAction(); |
||
| 39 | break; |
||
| 40 | case "stats": |
||
| 41 | $result = new StatsAction(); |
||
| 42 | break; |
||
| 43 | case "help": |
||
| 44 | $result = new HelpAction(); |
||
| 45 | break; |
||
| 46 | case "monitor": |
||
| 47 | $result = new MonitorAction(); |
||
| 48 | break; |
||
| 49 | default: |
||
| 50 | $result = new UnknownAction(); |
||
| 51 | break; |
||
| 52 | } |
||
| 53 | |||
| 54 | return $result; |
||
| 55 | } |
||
| 56 | } |
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.