Skip to content

Commit bf0772f

Browse files
Formatting
1 parent adc83ee commit bf0772f

19 files changed

+145
-146
lines changed

src/CurrenciesTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static function setDefaultCurrency($currency)
7979
*/
8080
public static function getISOCurrencies()
8181
{
82-
return (new ISOCurrencies())->getCurrencies();
82+
return (new ISOCurrencies)->getCurrencies();
8383
}
8484

8585
/**
@@ -118,23 +118,23 @@ private static function makeCurrencies($currenciesConfig)
118118
{
119119
if (! $currenciesConfig || ! is_array($currenciesConfig)) {
120120
// for backward compatibility
121-
return new ISOCurrencies();
121+
return new ISOCurrencies;
122122
}
123123

124124
$currenciesList = [];
125125

126126
if ($currenciesConfig['iso'] ?? false) {
127127
$currenciesList[] = static::makeCurrenciesForSource(
128128
$currenciesConfig['iso'],
129-
new ISOCurrencies(),
129+
new ISOCurrencies,
130130
'ISO'
131131
);
132132
}
133133

134134
if ($currenciesConfig['bitcoin'] ?? false) {
135135
$currenciesList[] = static::makeCurrenciesForSource(
136136
$currenciesConfig['bitcoin'],
137-
new BitcoinCurrencies(),
137+
new BitcoinCurrencies,
138138
'Bitcoin'
139139
);
140140
}

src/Money.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public function getAttributes()
9898
/**
9999
* Set currency.
100100
*
101-
* @param \Money\Currency|string $currency
102101
* @return \Cknow\Money\Money
103102
*/
104103
public function setCurrency(\Money\Currency|string $currency)

src/MoneyFormatterTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function formatByAggregate(array $formatters)
7171
*/
7272
public function formatByBitcoin($fractionDigits = 2, ?Currencies $currencies = null)
7373
{
74-
$formatter = new BitcoinMoneyFormatter($fractionDigits, $currencies ?: new BitcoinCurrencies());
74+
$formatter = new BitcoinMoneyFormatter($fractionDigits, $currencies ?: new BitcoinCurrencies);
7575

7676
return $this->formatByFormatter($formatter);
7777
}

src/MoneySerializerTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function serialize()
4949
*/
5050
public function serializeByArray()
5151
{
52-
$serializer = new ArrayMoneySerializer();
52+
$serializer = new ArrayMoneySerializer;
5353

5454
return $this->serializeBySerializer($serializer);
5555
}

src/MoneyServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function boot()
3434
});
3535

3636
Validator::extend('currency', function ($attribute, $value) {
37-
$rule = new Rules\Currency();
37+
$rule = new Rules\Currency;
3838

3939
return $rule->passes($attribute, $value);
4040
});

tests/BladeExtensionTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ protected function tearDown(): void
2828
Mockery::close();
2929
}
3030

31-
public function testCurrency()
31+
public function test_currency()
3232
{
3333
static::assertEquals(
3434
'<?php echo currency("USD"); ?>',
3535
$this->compiler->compileString('@currency("USD")')
3636
);
3737
}
3838

39-
public function testMoney()
39+
public function test_money()
4040
{
4141
static::assertEquals(
4242
'<?php echo money(500); ?>',
@@ -49,7 +49,7 @@ public function testMoney()
4949
);
5050
}
5151

52-
public function testMoneyMin()
52+
public function test_money_min()
5353
{
5454
static::assertEquals(
5555
'<?php echo money_min(money(100), money(200), money(300)); ?>',
@@ -62,7 +62,7 @@ public function testMoneyMin()
6262
);
6363
}
6464

65-
public function testMoneyMax()
65+
public function test_money_max()
6666
{
6767
static::assertEquals(
6868
'<?php echo money_max(money(100), money(200), money(300)); ?>',
@@ -75,7 +75,7 @@ public function testMoneyMax()
7575
);
7676
}
7777

78-
public function testMoneyAvg()
78+
public function test_money_avg()
7979
{
8080
static::assertEquals(
8181
'<?php echo money_avg(money(100), money(200), money(300)); ?>',
@@ -88,7 +88,7 @@ public function testMoneyAvg()
8888
);
8989
}
9090

91-
public function testMoneySum()
91+
public function test_money_sum()
9292
{
9393
static::assertEquals(
9494
'<?php echo money_sum(money(100), money(200), money(300)); ?>',
@@ -101,7 +101,7 @@ public function testMoneySum()
101101
);
102102
}
103103

104-
public function testMoneyParse()
104+
public function test_money_parse()
105105
{
106106
static::assertEquals(
107107
'<?php echo money_parse("R$5,00"); ?>',
@@ -114,7 +114,7 @@ public function testMoneyParse()
114114
);
115115
}
116116

117-
public function testMoneyParseByBitcoin()
117+
public function test_money_parse_by_bitcoin()
118118
{
119119
static::assertEquals(
120120
'<?php echo money_parse_by_bitcoin("\xC9\x831000.00"); ?>',
@@ -127,7 +127,7 @@ public function testMoneyParseByBitcoin()
127127
);
128128
}
129129

130-
public function testMoneyParseByDecimal()
130+
public function test_money_parse_by_decimal()
131131
{
132132
static::assertEquals(
133133
'<?php echo money_parse_by_decimal("5.00", "USD"); ?>',
@@ -140,7 +140,7 @@ public function testMoneyParseByDecimal()
140140
);
141141
}
142142

143-
public function testMoneyParseByIntl()
143+
public function test_money_parse_by_intl()
144144
{
145145
static::assertEquals(
146146
'<?php echo money_parse_by_intl("R$5,00"); ?>',
@@ -163,7 +163,7 @@ public function testMoneyParseByIntl()
163163
);
164164
}
165165

166-
public function testMoneyParseByIntlLocalizedDecimal()
166+
public function test_money_parse_by_intl_localized_decimal()
167167
{
168168
static::assertEquals(
169169
'<?php echo money_parse_by_intl_localized_decimal("1.00", "USD"); ?>',

tests/Currencies/ISOCurrenciesTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,69 +12,69 @@ protected function setUp(): void
1212
parent::setUp();
1313
}
1414

15-
public function testContains()
15+
public function test_contains()
1616
{
17-
$currencies = new ISOCurrencies();
17+
$currencies = new ISOCurrencies;
1818
static::assertTrue($currencies->contains(new \Money\Currency('EUR')));
1919
static::assertTrue($currencies->contains(new \Money\Currency('USD')));
2020
}
2121

22-
public function testSubunitFor()
22+
public function test_subunit_for()
2323
{
24-
$currencies = new ISOCurrencies();
24+
$currencies = new ISOCurrencies;
2525
static::assertEquals(2, $currencies->subunitFor(new \Money\Currency('EUR')));
2626
static::assertEquals(2, $currencies->subunitFor(new \Money\Currency('USD')));
2727
}
2828

29-
public function testSubunitForInvalidCurrency()
29+
public function test_subunit_for_invalid_currency()
3030
{
3131
$this->expectException(\Money\Exception\UnknownCurrencyException::class);
3232
$this->expectExceptionMessage('Cannot find ISO currency XYZ');
3333

34-
$currencies = new ISOCurrencies();
34+
$currencies = new ISOCurrencies;
3535
$currencies->subunitFor(new \Money\Currency('XYZ'));
3636
}
3737

38-
public function testNumericCodeFor()
38+
public function test_numeric_code_for()
3939
{
40-
$currencies = new ISOCurrencies();
40+
$currencies = new ISOCurrencies;
4141
static::assertEquals(978, $currencies->numericCodeFor(new \Money\Currency('EUR')));
4242
static::assertEquals(840, $currencies->numericCodeFor(new \Money\Currency('USD')));
4343
}
4444

45-
public function testNumericCodeForInvalidCurrency()
45+
public function test_numeric_code_for_invalid_currency()
4646
{
4747
$this->expectException(\Money\Exception\UnknownCurrencyException::class);
4848
$this->expectExceptionMessage('Cannot find ISO currency XYZ');
4949

50-
$currencies = new ISOCurrencies();
50+
$currencies = new ISOCurrencies;
5151
$currencies->numericCodeFor(new \Money\Currency('XYZ'));
5252
}
5353

54-
public function testLoadCurrencies()
54+
public function test_load_currencies()
5555
{
56-
$currencies = new ISOCurrencies();
56+
$currencies = new ISOCurrencies;
5757
static::assertContainsOnlyInstancesOf(\Money\Currency::class, $currencies->getIterator());
5858
}
5959

60-
public function testGetCurrencies()
60+
public function test_get_currencies()
6161
{
62-
$currencies = new ISOCurrencies();
62+
$currencies = new ISOCurrencies;
6363

6464
static::assertIsArray($currencies->getCurrencies());
6565
static::assertArrayHasKey('EUR', $currencies->getCurrencies());
6666
static::assertArrayHasKey('USD', $currencies->getCurrencies());
6767
static::assertArrayNotHasKey('XYZ', $currencies->getCurrencies());
6868
}
6969

70-
public function testInvalidConfigCurrenciesPath()
70+
public function test_invalid_config_currencies_path()
7171
{
7272
config(['money.isoCurrenciesPath' => null]);
7373

7474
$this->expectException(\RuntimeException::class);
7575
$this->expectExceptionMessage('Failed to load currency ISO codes.');
7676

77-
$currencies = new ISOCurrencies();
77+
$currencies = new ISOCurrencies;
7878

7979
$reflection = new \ReflectionObject($currencies);
8080
$property = $reflection->getProperty('currencies');

tests/CurrenciesTraitTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@ private static function currencyListSize(\Money\Currencies $currencies)
1919
return $size;
2020
}
2121

22-
public function testIsValidCurrency()
22+
public function test_is_valid_currency()
2323
{
2424
$mock = $this->getMockForTrait(CurrenciesTrait::class);
2525

2626
static::assertTrue($mock->isValidCurrency('USD'));
2727
static::assertTrue($mock->isValidCurrency(new Currency('USD')));
2828
}
2929

30-
public function testIsNotValidCurrency()
30+
public function test_is_not_valid_currency()
3131
{
3232
$mock = $this->getMockForTrait(CurrenciesTrait::class);
3333

3434
static::assertFalse($mock->isValidCurrency('FAIL'));
3535
static::assertFalse($mock->isValidCurrency(new Currency('FAIL')));
3636
}
3737

38-
public function testGetISOCurrencies()
38+
public function test_get_iso_currencies()
3939
{
4040
$mock = $this->getMockForTrait(CurrenciesTrait::class);
4141

@@ -44,24 +44,24 @@ public function testGetISOCurrencies()
4444
static::assertArrayHasKey('USD', $mock->getISOCurrencies());
4545
}
4646

47-
public function testGetCurrencies()
47+
public function test_get_currencies()
4848
{
4949
$mock = $this->getMockForTrait(CurrenciesTrait::class);
5050

5151
static::assertInstanceOf(\Money\Currencies::class, $mock->getCurrencies());
5252
static::assertInstanceOf(\Money\Currencies\AggregateCurrencies::class, $mock->getCurrencies());
5353
}
5454

55-
public function testSetCurrencies()
55+
public function test_set_currencies()
5656
{
5757
$mock = $this->getMockForTrait(CurrenciesTrait::class);
58-
$mock->setCurrencies(new \Money\Currencies\BitcoinCurrencies());
58+
$mock->setCurrencies(new \Money\Currencies\BitcoinCurrencies);
5959

6060
static::assertInstanceOf(\Money\Currencies::class, $mock->getCurrencies());
6161
static::assertInstanceOf(\Money\Currencies\BitcoinCurrencies::class, $mock->getCurrencies());
6262
}
6363

64-
public function testSetCurrenciesCustomCurrencies()
64+
public function test_set_currencies_custom_currencies()
6565
{
6666
$mock = $this->getMockForTrait(CurrenciesTrait::class);
6767
$mock->setCurrencies([
@@ -84,7 +84,7 @@ public function testSetCurrenciesCustomCurrencies()
8484
static::assertEquals(3, $mock->getCurrencies()->subunitFor(new Currency('MY2')));
8585
}
8686

87-
public function testSetCurrenciesWrongISOCurrencyCode()
87+
public function test_set_currencies_wrong_iso_currency_code()
8888
{
8989
$this->expectException(\InvalidArgumentException::class);
9090
$mock = $this->getMockForTrait(CurrenciesTrait::class);
@@ -98,7 +98,7 @@ public function testSetCurrenciesWrongISOCurrencyCode()
9898
]);
9999
}
100100

101-
public function testSetCurrenciesWrongBitcoinCurrencyCode()
101+
public function test_set_currencies_wrong_bitcoin_currency_code()
102102
{
103103
$this->expectException(\InvalidArgumentException::class);
104104
$mock = $this->getMockForTrait(CurrenciesTrait::class);
@@ -112,17 +112,17 @@ public function testSetCurrenciesWrongBitcoinCurrencyCode()
112112
]);
113113
}
114114

115-
public function testSetCurrenciesWrongStandardCurrenciesConfig()
115+
public function test_set_currencies_wrong_standard_currencies_config()
116116
{
117117
$this->expectException(\InvalidArgumentException::class);
118118
$mock = $this->getMockForTrait(CurrenciesTrait::class);
119119
$mock->setCurrencies([
120-
'iso' => new stdClass(),
120+
'iso' => new stdClass,
121121
'bitcoin' => 'all',
122122
]);
123123
}
124124

125-
public function testSetCurrenciesEmptyCurrenciesConfig()
125+
public function test_set_currencies_empty_currencies_config()
126126
{
127127
$mock = $this->getMockForTrait(CurrenciesTrait::class);
128128
$mock->setCurrencies([
@@ -135,36 +135,36 @@ public function testSetCurrenciesEmptyCurrenciesConfig()
135135
static::assertEquals(0, static::currencyListSize($mock->getCurrencies()));
136136
}
137137

138-
public function testSetCurrenciesDefaultCurrenciesConfig()
138+
public function test_set_currencies_default_currencies_config()
139139
{
140140
$mock = $this->getMockForTrait(CurrenciesTrait::class);
141141
$mock->setCurrencies([]);
142142

143143
static::assertInstanceOf(ISOCurrencies::class, $mock->getCurrencies());
144144
}
145145

146-
public function testSetCurrenciesAllISOCurrencies()
146+
public function test_set_currencies_all_iso_currencies()
147147
{
148148
$mock = $this->getMockForTrait(CurrenciesTrait::class);
149149
$mock->setCurrencies([
150150
'iso' => 'all',
151151
]);
152152

153153
static::assertEquals(
154-
new \Money\Currencies\AggregateCurrencies([new ISOCurrencies()]),
154+
new \Money\Currencies\AggregateCurrencies([new ISOCurrencies]),
155155
$mock->getCurrencies()
156156
);
157157
}
158158

159-
public function testSetCurrenciesAllBitcoinCurrencies()
159+
public function test_set_currencies_all_bitcoin_currencies()
160160
{
161161
$mock = $this->getMockForTrait(CurrenciesTrait::class);
162162
$mock->setCurrencies([
163163
'bitcoin' => 'all',
164164
]);
165165

166166
static::assertEquals(
167-
new \Money\Currencies\AggregateCurrencies([new \Money\Currencies\BitcoinCurrencies()]),
167+
new \Money\Currencies\AggregateCurrencies([new \Money\Currencies\BitcoinCurrencies]),
168168
$mock->getCurrencies()
169169
);
170170
}

0 commit comments

Comments
 (0)