You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LuIntDbo.php 916B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: robin
  5. * Date: 2/22/16
  6. * Time: 9:25 PM
  7. */
  8. namespace Luticate\Utils\Dbo;
  9. use Luticate\Utils\LuBusiness;
  10. use Luticate\Utils\LuDbo;
  11. class LuIntDbo extends LuDbo
  12. {
  13. /**
  14. * @var int
  15. */
  16. private $_value;
  17. /**
  18. * @return int
  19. */
  20. public function getInt()
  21. {
  22. return $this->_value;
  23. }
  24. /**
  25. * @param int $value
  26. */
  27. public function setInt($value)
  28. {
  29. $this->_value = $value;
  30. }
  31. function jsonSerialize()
  32. {
  33. return $this->_value;
  34. }
  35. public static function jsonDeserialize($json)
  36. {
  37. if (!is_numeric($json) || intval($json) != $json) {
  38. LuBusiness::badInput("Invalid integer value");
  39. }
  40. $val = new self();
  41. $val->setInt(intval($json));
  42. return $val;
  43. }
  44. public static function generateSample()
  45. {
  46. return 42;
  47. }
  48. }