From d644210b973b1b16e3feeb140c3da881667888fa Mon Sep 17 00:00:00 2001 From: Marco Cesarato Date: Tue, 19 Jan 2021 21:44:39 +0100 Subject: [PATCH] fix: move scope to string method to pretty string --- src/Changelog.php | 2 +- src/Commit/Scope.php | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Changelog.php b/src/Changelog.php index c920c77..8f9bdbe 100644 --- a/src/Changelog.php +++ b/src/Changelog.php @@ -222,7 +222,7 @@ public function generate(InputInterface $input, SymfonyStyle $output): int if (in_array($commit->getType(), $types)) { $itemKey = strtolower(preg_replace('/[^a-zA-Z0-9_-]+/', '', $commit->getDescription())); $type = (string)$commit->getType(); - $scope = (string)$commit->getScope(); + $scope = $commit->getScope()->toPrettyString(); $hash = $commit->getHash(); $changes[$type][$scope][$itemKey][$hash] = [ 'description' => ucfirst($commit->getDescription()), diff --git a/src/Commit/Scope.php b/src/Commit/Scope.php index 574b846..bedbc84 100644 --- a/src/Commit/Scope.php +++ b/src/Commit/Scope.php @@ -17,7 +17,10 @@ public function __construct(string $content) $this->content = $content; } - public function __toString(): string + /** + * Prettify. + */ + public function toPrettyString(): string { $string = ucfirst($this->content); $string = preg_replace('/[_]+/m', ' ', $string); @@ -27,4 +30,9 @@ public function __toString(): string return $string; } + + public function __toString(): string + { + return $this->content; + } }