Skip to content

Commit

Permalink
fixed some api output changes
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalkaoz committed Nov 18, 2015
1 parent 3b1988b commit 615489f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Output/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public function all(OutputInterface $output, array $response)
$response,
function ($key, $value) use ($output) {
if ('public' === $key) {
return $value === 1 ? 'Yes' : 'No';
return $value == 1 ? 'Yes' : 'No';
}

if (!in_array($key, ['out_number', 'licenses_red', 'licenses_unknown'], true)) {
return $value;
}

return $this->printBoolean($output, $value, 'No', $value > 0, false);
return $this->printBoolean($output, $value > 0 ? $value : 'No', $value, !$value, false);
}
);
}
Expand Down Expand Up @@ -119,7 +119,7 @@ private function output(OutputInterface $output, array $response)
$response,
function ($key, $value) use ($output) {
if (in_array($key, ['Outdated', 'Bad Licenses', 'Unknown Licenses'], true)) {
return $this->printBoolean($output, $value, 'No', $value > 0, false);
return $this->printBoolean($output, $value == 0 ? 'No' : $value, $value, !$value, false);
}

return $value;
Expand All @@ -135,14 +135,17 @@ function ($key, $value) use ($output) {
return implode(', ', array_column($value, 'name'));
}
if ('stable' === $key) {
return $this->printBoolean($output, 'No', 'Yes', !$value, false);
return $this->printBoolean($output, 'No', 'Yes', $value, false);
}
if ('outdated' === $key) {
return $this->printBoolean($output, 'Yes', 'No', $value, false);
return $this->printBoolean($output, 'No', 'Yes', !$value, false);
}

if ('security_vulnerabilities' === $key) {
return $this->printBoolean($output, 'No', implode(', ', array_column($value, 'cve')), count($value) === 0, false);
if (is_array($value)) {
return $this->printBoolean($output, 'No', implode(', ', array_column($value, 'cve')), count($value) === 0, false);
}
return $this->printBoolean($output, 'No', 'Yes', true, false);
}

return $value;
Expand Down

0 comments on commit 615489f

Please sign in to comment.