Skip to content

Commit b74591d

Browse files
authored
Update Byte.php
1 parent 278d119 commit b74591d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Byte.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,20 @@ public function equalTo(self|int|float|string $operand): bool
240240
return self::parse($operand) == $this->value;
241241
}
242242

243+
public function divide(self|int|float|string $value): self
244+
{
245+
if (($value = self::parse($value)) > $this->value) {
246+
throw new \LogicException('[$value] can not be greater than '. $this->value);
247+
}
248+
249+
return new self($this->value - $value);
250+
}
251+
252+
public function multiply(self|int|float|string $value): self
253+
{
254+
return new self($this->value * $value);
255+
}
256+
243257
/**
244258
* @param Byte|int|float|string $operand
245259
* @return bool

0 commit comments

Comments
 (0)