Skip to content

Commit

Permalink
Merge branch 'master' into 3.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/test.yml
  • Loading branch information
limingxinleo committed Oct 5, 2023
2 parents daef8a9 + dfe4ff8 commit a9399cb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Base62.php
Expand Up @@ -23,9 +23,9 @@ public static function encode(int $number): string
{
$chars = [];
while ($number > 0) {
$remain = $number % self::BASE;
$chars[] = self::CHARS[$remain];
$number = ($number - $remain) / self::BASE;
$remain = $number % static::BASE;
$chars[] = static::CHARS[$remain];
$number = ($number - $remain) / static::BASE;
}
return implode('', array_reverse($chars));
}
Expand All @@ -36,9 +36,9 @@ public static function decode(string $data): int
throw new InvalidArgumentException('The decode data contains content outside of CHARS.');
}
return array_reduce(array_map(function ($character) {
return strpos(self::CHARS, $character);
return strpos(static::CHARS, $character);
}, str_split($data)), function ($result, $remain) {
return $result * self::BASE + $remain;
return $result * static::BASE + $remain;
});
}
}

0 comments on commit a9399cb

Please sign in to comment.