PoolObject.php 764 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: yf
  5. * Date: 2019-01-06
  6. * Time: 22:48
  7. */
  8. namespace EasySwoole\Pool\Tests;
  9. use EasySwoole\Pool\ObjectInterface;
  10. class PoolObject implements ObjectInterface
  11. {
  12. protected $isOk = true;
  13. public function __construct($isOk)
  14. {
  15. $this->isOk = $isOk;
  16. }
  17. function get()
  18. {
  19. return self::class;
  20. }
  21. function gc()
  22. {
  23. }
  24. function objectRestore()
  25. {
  26. }
  27. function beforeUse(): ?bool
  28. {
  29. return $this->isOk;
  30. }
  31. /**
  32. * @return bool
  33. */
  34. public function isOk(): bool
  35. {
  36. return $this->isOk;
  37. }
  38. /**
  39. * @param bool $isOk
  40. */
  41. public function setIsOk(bool $isOk): void
  42. {
  43. $this->isOk = $isOk;
  44. }
  45. }