Proxy.php 840 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Qiniu\Http;
  3. use Qiniu\Http\RequestOptions;
  4. final class Proxy
  5. {
  6. private $proxy;
  7. private $proxy_auth;
  8. private $proxy_user_password;
  9. public function __construct($proxy = null, $proxy_auth = null, $proxy_user_password = null)
  10. {
  11. $this->proxy = $proxy;
  12. $this->proxy_auth = $proxy_auth;
  13. $this->proxy_user_password = $proxy_user_password;
  14. }
  15. public function makeReqOpt()
  16. {
  17. $reqOpt = new RequestOptions();
  18. if ($this->proxy !== null) {
  19. $reqOpt->proxy = $this->proxy;
  20. }
  21. if ($this->proxy_auth !== null) {
  22. $reqOpt->proxy_auth = $this->proxy_auth;
  23. }
  24. if ($this->proxy_user_password !== null) {
  25. $reqOpt->proxy_user_password = $this->proxy_user_password;
  26. }
  27. return $reqOpt;
  28. }
  29. }