WhmcsParams.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\UI\Traits;
  3. use function \ThurData\Servers\KerioEmail\Core\Helper\di;
  4. /**
  5. * WhmcsParams related functions
  6. *
  7. * @autor ThurData <info@thurdata.ch>
  8. */
  9. trait WhmcsParams
  10. {
  11. /**
  12. *
  13. * @var \ThurData\Servers\KerioEmail\Core\Helper\WhmcsParams
  14. */
  15. private $whmcsParams = null;
  16. public function initWhmcsParams()
  17. {
  18. if ($this->whmcsParams === null)
  19. {
  20. logModuleCall(
  21. 'kerioEmail',
  22. __FUNCTION__,
  23. $this,
  24. 'Debug Home',
  25. di('whmcsParams')
  26. );
  27. $this->whmcsParams = di('whmcsParams');
  28. }
  29. }
  30. protected function getWhmcsParamByKey($key, $default = false)
  31. {
  32. $this->initWhmcsParams();
  33. return $this->whmcsParams->getParamByKey($key, $default);
  34. }
  35. public function getWhmcsParamsByKeys(array $keys = [], $default = false)
  36. {
  37. $selectedParams = [];
  38. foreach ($keys as $key)
  39. {
  40. $selectedParams[$key] = $this->getWhmcsParamByKey($key, $default);
  41. }
  42. return $selectedParams;
  43. }
  44. }