ModuleConfigurationHandler.php 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Class ModuleConfigurationHandler
  4. * User: Nessandro
  5. * Date: 2019-11-19
  6. * Time: 08:21
  7. * @package ThurData\Servers\KerioEmail\App\Traits
  8. */
  9. namespace ThurData\Servers\KerioEmail\App\Traits;
  10. use ThurData\Servers\KerioEmail\Core\Configuration\Data;
  11. trait ModuleConfigurationHandler
  12. {
  13. /**
  14. *
  15. * @var Data
  16. */
  17. protected $moduleData;
  18. /**
  19. *
  20. * @return Data
  21. */
  22. public function getModuleData()
  23. {
  24. return $this->moduleData;
  25. }
  26. /**
  27. *
  28. * @param bool $reload
  29. * @return Data|null
  30. */
  31. public function loadModuleData($reload = false)
  32. {
  33. /**
  34. * unset data if need reload
  35. */
  36. if($reload)
  37. {
  38. $this->moduleData = null;
  39. }
  40. /**
  41. * load data
  42. */
  43. if(!$this->moduleData)
  44. {
  45. $this->moduleData = new Data();
  46. }
  47. /**
  48. * return data
  49. */
  50. return $this->moduleData;
  51. }
  52. }