ObjectArithmetic.php 894 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace MathPHP\Number;
  3. interface ObjectArithmetic
  4. {
  5. /**
  6. * Add two objects together
  7. *
  8. * @param mixed $object_or_scalar the value to be added
  9. *
  10. * @return ObjectArithmetic sum.
  11. */
  12. public function add($object_or_scalar);
  13. /**
  14. * Subtract one objects from another
  15. *
  16. * @param mixed $object_or_scalar the value to be subtracted
  17. *
  18. * @return ObjectArithmetic result.
  19. */
  20. public function subtract($object_or_scalar);
  21. /**
  22. * Multiply two objects together
  23. *
  24. * @param mixed $object_or_scalar value to be multiplied
  25. *
  26. * @return ObjectArithmetic product.
  27. */
  28. public function multiply($object_or_scalar);
  29. /**
  30. * Factory method to create the zero value of the object
  31. *
  32. * @return ObjectArithmetic
  33. */
  34. public static function createZeroValue(): ObjectArithmetic;
  35. }