選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

LuIntDboArray.php 1007B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: robin
  5. * Date: 2/22/16
  6. * Time: 9:40 PM
  7. */
  8. namespace Luticate\Utils\Dbo;
  9. class LuIntDboArray extends LuDboArray
  10. {
  11. /**
  12. * @var int[]
  13. */
  14. protected $_array;
  15. public function getArray()
  16. {
  17. return $this->_array;
  18. }
  19. public function setArray($value)
  20. {
  21. $this->_array = $value;
  22. }
  23. public function jsonSerialize()
  24. {
  25. return $this->_array;
  26. }
  27. public static function jsonDeserialize($json)
  28. {
  29. if (!is_array($json)) {
  30. throw new LuDboDeserializeException("Invalid array value");
  31. }
  32. $dbo = new self();
  33. $array = [];
  34. foreach ($json as $data) {
  35. $array[] = LuIntDbo::jsonDeserialize($data)->getInt();
  36. }
  37. $dbo->setArray($array);
  38. return $dbo;
  39. }
  40. public static function generateSample()
  41. {
  42. return [
  43. LuIntDbo::generateSample(),
  44. LuIntDbo::generateSample()
  45. ];
  46. }
  47. }