Skip to content

Commit

Permalink
fix: move scope to string method to pretty string
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocesarato committed Jan 19, 2021
1 parent 68b1ff9 commit d644210
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
10 changes: 9 additions & 1 deletion src/Commit/Scope.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -27,4 +30,9 @@ public function __toString(): string

return $string;
}

public function __toString(): string
{
return $this->content;
}
}

0 comments on commit d644210

Please sign in to comment.