Skip to content

Commit

Permalink
Update Byte.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Shelamkoff authored May 20, 2024
1 parent 278d119 commit b74591d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Byte.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,20 @@ public function equalTo(self|int|float|string $operand): bool
return self::parse($operand) == $this->value;
}

public function divide(self|int|float|string $value): self
{
if (($value = self::parse($value)) > $this->value) {
throw new \LogicException('[$value] can not be greater than '. $this->value);
}

return new self($this->value - $value);
}

public function multiply(self|int|float|string $value): self
{
return new self($this->value * $value);
}

/**
* @param Byte|int|float|string $operand
* @return bool
Expand Down

0 comments on commit b74591d

Please sign in to comment.