| Conditions | 7 |
| Paths | 11 |
| Total Lines | 58 |
| Code Lines | 34 |
| 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 |
||
| 32 | public function handle(SteamService $steamService): int |
||
| 33 | { |
||
| 34 | $title = $this->argument('title'); |
||
| 35 | $showDetails = $this->option('details'); |
||
| 36 | $outputJson = $this->option('json'); |
||
| 37 | |||
| 38 | $this->info("Searching for: {$title}"); |
||
| 39 | $this->newLine(); |
||
| 40 | |||
| 41 | // Search for the game |
||
| 42 | $appId = $steamService->search($title); |
||
| 43 | |||
| 44 | if ($appId === null) { |
||
| 45 | $this->error('No matching game found.'); |
||
| 46 | return Command::FAILURE; |
||
| 47 | } |
||
| 48 | |||
| 49 | $this->info("Found game with Steam App ID: {$appId}"); |
||
| 50 | $this->newLine(); |
||
| 51 | |||
| 52 | if ($showDetails) { |
||
| 53 | $details = $steamService->getGameDetails($appId); |
||
| 54 | |||
| 55 | if ($details === false) { |
||
| 56 | $this->error('Could not retrieve game details.'); |
||
| 57 | return Command::FAILURE; |
||
| 58 | } |
||
| 59 | |||
| 60 | if ($outputJson) { |
||
| 61 | $this->line(json_encode($details, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); |
||
| 62 | } else { |
||
| 63 | $this->displayGameDetails($details); |
||
| 64 | } |
||
| 65 | |||
| 66 | // Get additional data |
||
| 67 | $reviews = $steamService->getReviewsSummary($appId); |
||
| 68 | $playerCount = $steamService->getPlayerCount($appId); |
||
| 69 | |||
| 70 | if ($reviews !== null) { |
||
| 71 | $this->newLine(); |
||
| 72 | $this->info('Reviews:'); |
||
| 73 | $this->table( |
||
| 74 | ['Metric', 'Value'], |
||
| 75 | [ |
||
| 76 | ['Rating', $reviews['review_score_desc'] ?? 'Unknown'], |
||
| 77 | ['Positive', number_format($reviews['total_positive'] ?? 0)], |
||
| 78 | ['Negative', number_format($reviews['total_negative'] ?? 0)], |
||
| 79 | ['Total', number_format($reviews['total_reviews'] ?? 0)], |
||
| 80 | ] |
||
| 81 | ); |
||
| 82 | } |
||
| 83 | |||
| 84 | if ($playerCount !== null) { |
||
| 85 | $this->info("Current Players: " . number_format($playerCount)); |
||
| 86 | } |
||
| 87 | } |
||
| 88 | |||
| 89 | return Command::SUCCESS; |
||
| 90 | } |
||
| 182 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths