Skip to content

Commit acc0588

Browse files
vuongxuongminhStyleCIBot
authored andcommitted
Apply fixes from StyleCI
1 parent e342e51 commit acc0588

12 files changed

+37
-9
lines changed

src/Concerns/Collapse.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -9,6 +10,7 @@
910

1011
/**
1112
* @author Vuong Minh <[email protected]>
13+
*
1214
* @since 1.2.0
1315
*/
1416
trait Collapse
@@ -18,6 +20,7 @@ trait Collapse
1820
*
1921
* @param array|string[] $words
2022
* @return string
23+
*
2124
* @since 1.2.0
2225
*/
2326
protected function collapseWords(array $words): string

src/Concerns/NumberResolver.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -11,6 +12,7 @@
1112

1213
/**
1314
* @author Vuong Minh <[email protected]>
15+
*
1416
* @since 1.0.5
1517
*/
1618
trait NumberResolver
@@ -20,6 +22,7 @@ trait NumberResolver
2022
*
2123
* @param int|float|string $number
2224
* @return array
25+
*
2326
* @throws InvalidArgumentException
2427
*/
2528
protected function resolveNumber($number): array
@@ -28,7 +31,6 @@ protected function resolveNumber($number): array
2831
throw new InvalidArgumentException(sprintf('Number arg (`%s`) must be numeric!', $number));
2932
}
3033

31-
3234
if ($this->decimalPart === null) {
3335
$number += 0; // trick xóa các số 0 lẻ sau cùng của phân số đối với input là chuỗi.
3436
$number = (string) $number;

src/Concerns/TripletTransformer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -9,6 +10,7 @@
910

1011
/**
1112
* @author Vuong Minh <[email protected]>
13+
*
1214
* @since 1.0.0
1315
*/
1416
trait TripletTransformer

src/Concerns/TripletsConverter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -9,14 +10,15 @@
910

1011
/**
1112
* @author Vuong Minh <[email protected]>
13+
*
1214
* @since 1.0.0
1315
*/
1416
trait TripletsConverter
1517
{
1618
/**
1719
* Chia số truyền vào thành các cụm gồm 3 số để hổ trợ cho việc chuyển sang chữ số.
1820
*
19-
* @param int $number
21+
* @param int $number
2022
* @return array|int[]
2123
*/
2224
protected function numberToTriplets(int $number): array

src/Dictionary.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -11,6 +12,7 @@
1112

1213
/**
1314
* @author Vuong Minh <[email protected]>
15+
*
1416
* @since 1.0.0
1517
*/
1618
class Dictionary implements DictionaryInterface

src/DictionaryInterface.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -9,6 +10,7 @@
910

1011
/**
1112
* @author Vuong Minh <[email protected]>
13+
*
1214
* @since 1.0.0
1315
*/
1416
interface DictionaryInterface
@@ -72,31 +74,31 @@ public function tripletTenSeparator(): string;
7274
/**
7375
* Trả về từ ngữ hàng đơn vị tương ứng với số truyền vào.
7476
*
75-
* @param int $unit hàng đơn vị
77+
* @param int $unit hàng đơn vị
7678
* @return string
7779
*/
7880
public function getTripletUnit(int $unit): string;
7981

8082
/**
8183
* Trả về từ ngữ hàng chục tương ứng với số truyền vào.
8284
*
83-
* @param int $ten hàng chục
85+
* @param int $ten hàng chục
8486
* @return string
8587
*/
8688
public function getTripletTen(int $ten): string;
8789

8890
/**
8991
* Trả về từ ngữ hàng trăm tương ứng với số truyền vào.
9092
*
91-
* @param int $hundred hàng trăm
93+
* @param int $hundred hàng trăm
9294
* @return string
9395
*/
9496
public function getTripletHundred(int $hundred): string;
9597

9698
/**
9799
* Trả về đơn vị tương ứng với số mũ cơ số 3.
98100
*
99-
* @param int $power hàng trăm
101+
* @param int $power hàng trăm
100102
* @return string
101103
*/
102104
public function getExponent(int $power): string;

src/SouthDictionary.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -9,6 +10,7 @@
910

1011
/**
1112
* @author Vuong Minh <[email protected]>
13+
*
1214
* @since 1.0.0
1315
*/
1416
class SouthDictionary extends Dictionary

src/Transformer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -9,6 +10,7 @@
910

1011
/**
1112
* @author Vuong Minh <[email protected]>
13+
*
1214
* @since 1.0.0
1315
*/
1416
class Transformer
@@ -25,6 +27,7 @@ class Transformer
2527

2628
/**
2729
* Mặc định bỏ số các số 0 sau phần thập phân.
30+
*
2831
* @var int
2932
*/
3033
protected $decimalPart;
@@ -49,6 +52,7 @@ public function __construct(?DictionaryInterface $dictionary = null, $decimalPar
4952
*
5053
* @param int|float|string $number
5154
* @return string
55+
*
5256
* @throws \InvalidArgumentException
5357
*/
5458
public function toWords($number): string
@@ -82,6 +86,7 @@ public function toWords($number): string
8286
* @param $number
8387
* @param array|string[]|string $unit
8488
* @return string
89+
*
8590
* @throws \InvalidArgumentException
8691
*/
8792
public function toCurrency($number, $unit = 'đồng'): string

tests/CurrencyTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -11,6 +12,7 @@
1112

1213
/**
1314
* @author Vuong Minh <[email protected]>
15+
*
1416
* @since 1.0.0
1517
*/
1618
class CurrencyTest extends TestCase
@@ -36,7 +38,7 @@ public function testUSDTransform($expect, $number)
3638
*/
3739
public function testUSDSetDecimalPart($expect, $float, $decimalPart)
3840
{
39-
$transformer = new Transformer($this->dictionary, $decimalPart);
41+
$transformer = new Transformer($this->dictionary, $decimalPart);
4042

4143
$this->assertEquals($expect, $transformer->toCurrency($float, ['đô', 'xen']));
4244
}
@@ -64,7 +66,7 @@ public function usdDecimalPartDataProvider(): array
6466
*/
6567
public function testSetDecimalPart($expect, $float, $decimalPart)
6668
{
67-
$transformer = new Transformer($this->dictionary, $decimalPart);
69+
$transformer = new Transformer($this->dictionary, $decimalPart);
6870
$this->assertEquals($expect, $transformer->toCurrency($float));
6971
}
7072

tests/NumberTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
/**
33
* @link https://github.com/phpviet/number-to-words
4+
*
45
* @copyright (c) PHP Viet
56
* @license [MIT](http://www.opensource.org/licenses/MIT)
67
*/
@@ -11,6 +12,7 @@
1112

1213
/**
1314
* @author Vuong Minh <[email protected]>
15+
*
1416
* @since 1.0.0
1517
*/
1618
class NumberTest extends TestCase
@@ -44,7 +46,7 @@ public function testFractionTransform($expect, $float)
4446
*/
4547
public function testSetDecimalPart($expect, $float, $decimalPart)
4648
{
47-
$transformer = new Transformer($this->dictionary, $decimalPart);
49+
$transformer = new Transformer($this->dictionary, $decimalPart);
4850

4951
$this->assertEquals($expect, $transformer->toWords($float));
5052
}

0 commit comments

Comments
 (0)