From d4709443f7ee70a3eb001f103738b89bd4f6cf26 Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 17 Aug 2023 14:05:14 -0400 Subject: [PATCH] Corrected code-smell and code style issues in `\ncc\Classes > GitClient` --- CHANGELOG.md | 1 + src/ncc/Classes/GitClient.php | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4549587..f70d2b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Corrected code-smell and code style issues in `\ncc\Classes > HttpClient` + - Corrected code-smell and code style issues in `\ncc\Classes > GitClient` diff --git a/src/ncc/Classes/GitClient.php b/src/ncc/Classes/GitClient.php index c1ece12..9929f7b 100644 --- a/src/ncc/Classes/GitClient.php +++ b/src/ncc/Classes/GitClient.php @@ -48,11 +48,19 @@ namespace ncc\Classes; $process->setTimeout(3600); // 1 hour $process->run(function ($type, $buffer) { - Console::outVerbose($buffer); + if(Process::ERR === $type) + { + Console::outWarning($buffer); + } + { + Console::outVerbose($buffer); + } }); if (!$process->isSuccessful()) + { throw new GitCloneException($process->getErrorOutput()); + } Console::outVerbose('Repository cloned to: ' . $path); @@ -131,7 +139,9 @@ namespace ncc\Classes; }); if (!$process->isSuccessful()) + { throw new GitTagsException($process->getErrorOutput()); + } $process = new Process(['git', '--no-pager', 'tag', '-l'] , $path); @@ -141,10 +151,12 @@ namespace ncc\Classes; }); if (!$process->isSuccessful()) + { throw new GitTagsException($process->getErrorOutput()); + } $tags = explode(PHP_EOL, $process->getOutput()); - $tags = array_filter($tags, function ($tag) + $tags = array_filter($tags, static function ($tag) { return !empty($tag); });