Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
M
money-datatype
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
package
money-datatype
Commits
621d7892
Commit
621d7892
authored
Jul 22, 2016
by
Thorsten Buss
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FIX: json interfaces implemented and fix the int check
parent
a9d0cdcf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
Money.php
src/Money/Money.php
+4
-3
No files found.
src/Money/Money.php
View file @
621d7892
...
...
@@ -8,6 +8,7 @@
namespace
Bnet\Money
;
use
Illuminate\Contracts\Support\Jsonable
;
use
Illuminate\Support\Str
;
/**
...
...
@@ -17,7 +18,7 @@ use Illuminate\Support\Str;
* @method static Money EUR(int $amount)
* @method static Money USD(int $amount)
*/
class
Money
{
class
Money
implements
\JsonSerializable
,
Jsonable
{
/**
* @var int cents of currency
...
...
@@ -36,7 +37,7 @@ class Money {
* @throws MoneyException
*/
public
function
__construct
(
$amount
,
$currency
=
null
)
{
if
(
intval
(
$amount
)
!==
$amount
)
{
if
(
!
is_int
(
$amount
)
&&
!
ctype_digit
(
$amount
)
)
{
throw
new
MoneyException
(
'Amount must be an integer'
);
}
...
...
@@ -409,7 +410,7 @@ class Money {
'amount'
=>
$this
->
amount
,
'number'
=>
$this
->
normalize
(),
'format'
=>
$this
->
format
(),
'currency'
=>
$this
->
currency
,
'currency'
=>
$this
->
currency
->
code
,
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment