PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/zendframework/zend-soap/src/Client/Local.php

https://gitlab.com/daigiangaitu91/magento
PHP | 73 lines | 27 code | 9 blank | 37 comment | 3 complexity | 1c9152de1e0ed7bb348b1355bdebf234 MD5 | raw file
  1. <?php
  2. /**
  3. * Zend Framework (http://framework.zend.com/)
  4. *
  5. * @link http://github.com/zendframework/zf2 for the canonical source repository
  6. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  7. * @license http://framework.zend.com/license/new-bsd New BSD License
  8. */
  9. namespace Zend\Soap\Client;
  10. use Zend\Soap\Client as SOAPClient;
  11. use Zend\Soap\Server as SOAPServer;
  12. /**
  13. * Class is intended to be used as local SOAP client which works
  14. * with a provided Server object.
  15. *
  16. * Could be used for development or testing purposes.
  17. */
  18. class Local extends SOAPClient
  19. {
  20. /**
  21. * Server object
  22. * @var SOAPServer
  23. */
  24. protected $server;
  25. /**
  26. * Local client constructor
  27. *
  28. * @param SOAPServer $server
  29. * @param string $wsdl
  30. * @param array $options
  31. */
  32. public function __construct(SOAPServer $server, $wsdl, $options = null)
  33. {
  34. $this->server = $server;
  35. // Use Server specified SOAP version as default
  36. $this->setSoapVersion($server->getSoapVersion());
  37. parent::__construct($wsdl, $options);
  38. }
  39. /**
  40. * Actual "do request" method.
  41. *
  42. * @param Common $client
  43. * @param string $request
  44. * @param string $location
  45. * @param string $action
  46. * @param int $version
  47. * @param int $oneWay
  48. * @return mixed
  49. */
  50. public function _doRequest(Common $client, $request, $location, $action, $version, $oneWay = null)
  51. {
  52. // Perform request as is
  53. ob_start();
  54. $this->server->handle($request);
  55. $response = ob_get_clean();
  56. if ($response === null || $response === '') {
  57. $serverResponse = $this->server->getResponse();
  58. if ($serverResponse !== null) {
  59. $response = $serverResponse;
  60. }
  61. }
  62. return $response;
  63. }
  64. }