YlyConfig.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace addon\printer\data\sdk\yilianyun\config;
  3. use InvalidArgumentException;
  4. class YlyConfig{
  5. private $clientId = '';
  6. private $clientSecret = '';
  7. private $requestUrl = "https://open-api.10ss.net";
  8. private $log;
  9. public function __construct($clientId, $clientSecret)
  10. {
  11. if ($clientId == null || $clientId == "") {
  12. throw new InvalidArgumentException("clientId is required");
  13. }
  14. if ($clientSecret == null || $clientSecret == "") {
  15. throw new InvalidArgumentException("clientSecret is required");
  16. }
  17. $this->clientId = $clientId;
  18. $this->clientSecret = $clientSecret;
  19. }
  20. public function getClientId()
  21. {
  22. return $this->clientId;
  23. }
  24. public function getClientSecret()
  25. {
  26. return $this->clientSecret;
  27. }
  28. public function getRequestUrl()
  29. {
  30. return $this->requestUrl;
  31. }
  32. public function setRequestUrl($requestUrl)
  33. {
  34. $this->requestUrl = $requestUrl;
  35. }
  36. public function getLog()
  37. {
  38. return $this->log;
  39. }
  40. public function setLog($log)
  41. {
  42. if (!method_exists($log, "info")) {
  43. throw new InvalidArgumentException("logger need have method 'info(\$message)'");
  44. }
  45. if (!method_exists($log, "error")) {
  46. throw new InvalidArgumentException("logger need have method 'error(\$message)'");
  47. }
  48. $this->log = $log;
  49. }
  50. }