Skip to content

Commit

Permalink
pass tests (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenExe committed Mar 13, 2017
1 parent 42d0a20 commit d8eca46
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Dashatizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,16 @@

class Dashatizer
{
public function dashatize(int $num): string
public function dashatize(int $number): string
{
$digits = str_split($number);

$result = [];

foreach ($digits as $digit) {
$result[] = $digit & 1 ? "-$digit-" : $digit;
}

return trim(str_replace('--', '-', implode('', $result)), '-');
}
}

0 comments on commit d8eca46

Please sign in to comment.