Skip to content

Commit

Permalink
Update package
Browse files Browse the repository at this point in the history
  • Loading branch information
sagikazarmark committed Feb 17, 2018
1 parent db5a81d commit 66e182c
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .flintci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
services:
phpcsfixer:
20 changes: 12 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
/doc/ export-ignore
/resources/logo.png export-ignore
/spec/ export-ignore
/tests/ export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
/.flintci.yml export-ignore
/.github/ export-ignore
/.php_cs.dist export-ignore
/.scrutinizer.yml export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/phpspec.ci.yml export-ignore
/phpspec.yml.dist export-ignore
/phpunit.xml.dist export-ignore
/spec/ export-ignore
/tests/ export-ignore

/doc/ export-ignore
/resources/logo.png export-ignore
12 changes: 8 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
build/
.php_cs
.php_cs.cache
/build/
/composer.lock
/phpspec.yml
/phpunit.xml
/vendor/

doc/_build/
vendor/
composer.lock
phpunit.xml
7 changes: 0 additions & 7 deletions .php_cs

This file was deleted.

15 changes: 15 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('spec')
->in(__DIR__)
;

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
])
->setFinder($finder)
;
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ matrix:
fast_finish: true
include:
- php: 5.6
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true
env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-coverage"

before_install:
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
Expand Down
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Copyright (c) 2011-2016 Mathias Verraes
Copyright (c) 2016 Márk Sági-Kazár <mark.sagikazar@gmail.com>
Copyright (c) 2016 Frederik Bosch <f.bosch@genkgo.nl>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ The documentation is available at http://moneyphp.org

PHP 5.6+. Other than that, this library has no external requirements. MoneyPHP will not provide any support to
PHP versions that are [not supported by the language itself](http://php.net/supported-versions.php). There might be
additional dependencies for specific feature, e.g. the swap implementation.
additional dependencies for specific feature, e.g. the Swap exchange implementation, check the documentation for more information.


## Install
Expand Down
16 changes: 11 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "moneyphp/money",
"description": "PHP implementation of Fowler's Money pattern",
"keywords": ["money", "vo", "value object"],
"homepage": "http://verraes.net/2011/04/fowler-money-pattern-in-php/",
"license": "MIT",
"keywords": ["money", "vo", "value object"],
"homepage": "http://moneyphp.org",
"authors": [
{
"name": "Mathias Verraes",
Expand All @@ -12,7 +12,7 @@
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagi-kazar@gmail.com"
"email": "mark.sagikazar@gmail.com"
},
{
"name": "Frederik Bosch",
Expand Down Expand Up @@ -57,12 +57,16 @@
"spec\\Money\\": "spec/"
}
},
"config": {
"sort-packages": true
},
"scripts": {
"clean": "rm -rf build/ vendor/",
"test": [
"vendor/bin/phpspec run",
"vendor/bin/phpunit -v"
],
"test-ci": [
"test-coverage": [
"vendor/bin/phpspec run -c phpspec.ci.yml",
"vendor/bin/phpunit -v --coverage-text --coverage-clover=build/unit_coverage.xml"
],
Expand All @@ -72,5 +76,7 @@
"branch-alias": {
"dev-master": "3.0-dev"
}
}
},
"prefer-stable": true,
"minimum-stability": "dev"
}
15 changes: 15 additions & 0 deletions spec/.php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
;

return PhpCsFixer\Config::create()
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
'yoda_style' => false,
'visibility_required' => [],
])
->setFinder($finder)
;
1 change: 0 additions & 1 deletion spec/Calculator/CalculatorBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ function it_calculates_the_absolute_value()
$result->shouldBeGreaterThanZero();
$result->shouldBeString();


$result = $this->absolute(rand(-100, -1));

$result->shouldBeGreaterThanZero();
Expand Down
3 changes: 2 additions & 1 deletion spec/ConverterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function it_is_initializable()
$this->shouldHaveType(Converter::class);
}

function it_converts_to_a_different_currency(Currencies $currencies, Exchange $exchange) {
function it_converts_to_a_different_currency(Currencies $currencies, Exchange $exchange)
{
$baseCurrency = new Currency($baseCurrencyCode = 'ABC');
$counterCurrency = new Currency($counterCurrencyCode = 'XYZ');
$pair = new CurrencyPair($baseCurrency, $counterCurrency, 0.5);
Expand Down
4 changes: 2 additions & 2 deletions spec/Exchange/FixedExchangeSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ function let()
{
$this->beConstructedWith([
'EUR' => [
'USD' => 1.25
]
'USD' => 1.25,
],
]);
}

Expand Down
2 changes: 1 addition & 1 deletion spec/Formatter/AggregateMoneyFormatterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

final class AggregateMoneyFormatterSpec extends ObjectBehavior
{
function let (MoneyFormatter $moneyFormatter)
function let(MoneyFormatter $moneyFormatter)
{
$this->beConstructedWith([
'EUR' => $moneyFormatter,
Expand Down
22 changes: 11 additions & 11 deletions spec/MoneySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,27 +215,27 @@ function it_allocates_amount(Calculator $calculator)
{
$this->beConstructedWith(100, new Currency(self::CURRENCY));

$calculator->share(Argument::type('numeric'), Argument::type('int'), Argument::type('int'))->will(function($args) {
$calculator->share(Argument::type('numeric'), Argument::type('int'), Argument::type('int'))->will(function ($args) {
return (int) floor($args[0] * $args[1] / $args[2]);
});

$calculator->subtract(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->subtract(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return (string) $args[0] - $args[1];
});

$calculator->add(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->add(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return (string) ($args[0] + $args[1]);
});

$calculator->compare(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->compare(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return ($args[0] < $args[1]) ? -1 : (($args[0] > $args[1]) ? 1 : 0);
});

$calculator->absolute(Argument::type('numeric'))->will(function($args) {
$calculator->absolute(Argument::type('numeric'))->will(function ($args) {
return ltrim($args[0], '-');
});

$calculator->multiply(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->multiply(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return (string) $args[0] * $args[1];
});

Expand All @@ -248,19 +248,19 @@ function it_allocates_amount_to_n_targets(Calculator $calculator)
{
$this->beConstructedWith(15, new Currency(self::CURRENCY));

$calculator->share(Argument::type('numeric'), Argument::type('int'), Argument::type('int'))->will(function($args) {
$calculator->share(Argument::type('numeric'), Argument::type('int'), Argument::type('int'))->will(function ($args) {
return (int) floor($args[0] * $args[1] / $args[2]);
});

$calculator->subtract(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->subtract(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return $args[0] - $args[1];
});

$calculator->add(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->add(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return $args[0] + $args[1];
});

$calculator->compare(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->compare(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return ($args[0] < $args[1]) ? -1 : (($args[0] > $args[1]) ? 1 : 0);
});

Expand Down Expand Up @@ -299,7 +299,7 @@ function it_has_comparators(Calculator $calculator)
{
$this->beConstructedWith(1, new Currency(self::CURRENCY));

$calculator->compare(Argument::type('numeric'), Argument::type('int'))->will(function($args) {
$calculator->compare(Argument::type('numeric'), Argument::type('int'))->will(function ($args) {
return ($args[0] < $args[1]) ? -1 : (($args[0] > $args[1]) ? 1 : 0);
});

Expand Down
2 changes: 1 addition & 1 deletion spec/Parser/BitcoinMoneyParserSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function it_is_a_money_parser()

function it_parses_money()
{
$money = $this->parse("Ƀ1000.00");
$money = $this->parse('Ƀ1000.00');

$money->shouldHaveType(Money::class);
$money->getCurrency()->getCode()->shouldReturn(BitcoinCurrencies::CODE);
Expand Down

0 comments on commit 66e182c

Please sign in to comment.