Skip to content

Commit

Permalink
Make storeResult() less complex and go for the 10 at scrutinizer-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
mtolhuys committed Jul 20, 2019
1 parent a4554d2 commit d57f957
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/LaravelEnvScanner.php
Expand Up @@ -91,20 +91,25 @@ private function getResult(array $values)
*/
private function storeResult(string $file, $result)
{
$resultData = [
'filename' => $this->getFilename($file),
'has_value' => '-',
'depending_on_default' => '-',
'empty' => '-',
];

if ($result->hasValue) {
$resultData['has_value'] = $result->envVar;
$this->results['has_value']++;
} else if ($result->hasDefault) {
$resultData['depending_on_default'] = $result->envVar;
$this->results['depending_on_default']++;
} else {
$resultData['empty'] = $result->envVar;
$this->results['empty']++;
}

$this->results['data'][] = [
'filename' => $this->getFilename($file),
'has_value' => $result->hasValue ? $result->envVar : '-',
'depending_on_default' => !$result->hasValue && $result->hasDefault ? $result->envVar : '-',
'empty' => !$result->hasValue && !$result->hasDefault ? $result->envVar : '-',
];
$this->results['data'][] = $resultData;
}

private function getFilename(string $file)
Expand Down

0 comments on commit d57f957

Please sign in to comment.