Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deal with integer limits #115

Merged
merged 4 commits into from
Jan 4, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Calculator.php
Original file line number Diff line number Diff line change
@@ -2,13 +2,16 @@
namespace Money;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why this is necessary, but OK, I will add it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency.


/**
* Interface Calculator
* @package Money
* Calculator Interface
* @author Frederik Bosch
*/
interface Calculator
{

/**
* Returns whether the calculator is supported in
* the current server environment
*
* @return bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's kind of obvious, but can you please add some documentation here as well?

*/
public static function supported();
5 changes: 3 additions & 2 deletions src/Money.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Money;

use InvalidArgumentException;
@@ -483,17 +484,17 @@ public function jsonSerialize()
*/
public static function registerCalculator(Calculator $calculator)
{
self::$calculators = $calculator + self::$calculators;
array_unshift(self::$calculators, $calculator);
}

/**
* @return Calculator
*/
private static function initializeCalculator()
{
/** @var Calculator[] $calculators */
$calculators = self::$calculators;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove this line and modify the docblock to Calculator $calculator

foreach ($calculators as $calculator) {
/** @var Calculator $calculator */
if ($calculator::supported()) {
return new $calculator;
}