Last active
March 7, 2019 10:45
-
-
Save ger86/619944189b430d58f0e6dd10fcfcd3fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Service; | |
final class StripeUtils { | |
/** | |
* Converts an amount in format 20.123 to string 2012 | |
* | |
* @param float $amount | |
* @return string | |
*/ | |
public function convertToStringAmount(float $amount): string { | |
$amountRounded = round($amount, 2); | |
return strval(intval($amountRounded * 100)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment