File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ public function withMajorUnit($amount)
4040 {
4141 if (is_int ($ amount ) || is_float ($ amount ) || (is_string ($ amount ) && preg_match ('/^[0-9]*\.[0-9]*$/ ' , $ amount ))) {
4242 $ amount = (float )$ amount * pow (10 , $ this ->currency ->getDigits ());
43-
44- if (floor ($ amount ) != $ amount ) {
43+ var_dump ( floor ( $ amount )); var_dump ( round ( $ amount , 6 ));
44+ if (floor ($ amount ) != round ( $ amount, 6 ) ) {
4545 // Too many decimal digits for the currency.
4646 throw new UnexpectedValueException (sprintf (
4747 'Amount has too many decimal places. Calculated minor unit %f should be an integer. ' ,
@@ -50,11 +50,11 @@ public function withMajorUnit($amount)
5050 }
5151
5252 $ clone = clone $ this ;
53- $ clone ->amount = ( int )$ amount ;
53+ $ clone ->setMinorUnit (( int )$ amount) ;
5454 return $ clone ;
5555 } else {
5656 throw new UnexpectedValueException (sprintf (
57- 'Amount is an unexpected data type . '
57+ 'Major Unit must be a number . '
5858 ));
5959 }
6060 }
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ public function getCode()
6060 */
6161 public function getMinorUnits ()
6262 {
63- return ($ this ->all_currencies ->get ($ this ->code , 'exp ' ) );
63+ return ($ this ->all_currencies ->getByAlpha3 ($ this ->code )[ 'exp ' ] );
6464 }
6565
6666 /**
@@ -81,6 +81,6 @@ public function getDigits()
8181 */
8282 public function getName ()
8383 {
84- return ($ this ->all_currencies ->get ($ this ->code , 'name ' ) );
84+ return ($ this ->all_currencies ->getByAlpha3 ($ this ->code )[ 'name ' ] );
8585 }
8686}
You can’t perform that action at this time.
0 commit comments