WhmcsParams.php 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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@thrudata.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. $this->whmcsParams = di('whmcsParams');
  21. }
  22. }
  23. protected function getWhmcsParamByKey($key, $default = false)
  24. {
  25. $this->initWhmcsParams();
  26. return $this->whmcsParams->getParamByKey($key, $default);
  27. }
  28. public function getWhmcsParamsByKeys(array $keys = [], $default = false)
  29. {
  30. $selectedParams = [];
  31. foreach ($keys as $key)
  32. {
  33. $selectedParams[$key] = $this->getWhmcsParamByKey($key, $default);
  34. }
  35. return $selectedParams;
  36. }
  37. }