Skip to content

Commit 7bb930b

Browse files
committed
Change multiply, divide method names
1 parent 6f50957 commit 7bb930b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ echo $size->asAuto(); // '1.15 TB'
4646

4747
### Modify the size
4848

49-
To make changes, use `add()`, `subtract()`, `multiply()`, and `divide()`. A variety of file size strings are supported here as well.
49+
To make changes, use `add()`, `subtract()`, `multiplyBy()`, and `divideBy()`. A variety of file size strings are supported here as well.
5050

5151
```php
5252
$size = new FileSize('4 GB');
5353

5454
$size->add('2G')
5555
->subtract('1 gigabytes')
56-
->multiply(4)
57-
->divide(2);
56+
->multiplyBy(4)
57+
->divideBy(2);
5858

5959
echo $size->asAuto(); // '10.00 GB'
6060
```

src/FileSize.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function subtract($size)
9393
* @param int|float $n A number
9494
* @return self
9595
*/
96-
public function multiply($n)
96+
public function multiplyBy($n)
9797
{
9898
$this->bytes = self::formatBytes($this->bytes * $n);
9999

@@ -106,9 +106,9 @@ public function multiply($n)
106106
* @param int|float $n A number
107107
* @return self
108108
*/
109-
public function divide($n)
109+
public function divideBy($n)
110110
{
111-
return $this->multiply(1 / $n);
111+
return $this->multiplyBy(1 / $n);
112112
}
113113

114114
/**

tests/FileSizeTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ public function testSubtract()
4040
$this->assertSame($size->as('B'), 128821248);
4141
}
4242

43-
public function testMultiply()
43+
public function testMultiplyBy()
4444
{
4545
$size = new FileSize('425.51 m');
46-
$size->multiply(9.125);
46+
$size->multiplyBy(9.125);
4747

4848
$this->assertSame($size->as('GB'), 3.79);
4949
}
5050

51-
public function testDivide()
51+
public function testDivideBy()
5252
{
5353
$size = new FileSize('300K');
54-
$size->divide(2);
54+
$size->divideBy(2);
5555

5656
$this->assertSame($size->as('KB'), (float) 150);
5757
}
@@ -87,7 +87,7 @@ public function testAuto1()
8787
public function testAuto2()
8888
{
8989
$size = new FileSize('1.2345 KB');
90-
$size->multiply(0.333);
90+
$size->multiplyBy(0.333);
9191

9292
$this->assertSame($size->asAuto(2), '422 B');
9393
}

0 commit comments

Comments
 (0)