LocateIPResponse.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Service
  17. * @subpackage DeveloperGarden
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. /**
  23. * @see Zend_Service_DeveloperGarden_Response_BaseType
  24. */
  25. require_once 'Zend/Service/DeveloperGarden/Response/BaseType.php';
  26. /**
  27. * @category Zend
  28. * @package Zend_Service
  29. * @subpackage DeveloperGarden
  30. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @author Marco Kaiser
  32. * @license http://framework.zend.com/license/new-bsd New BSD License
  33. */
  34. class Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponse
  35. extends Zend_Service_DeveloperGarden_Response_BaseType
  36. {
  37. /**
  38. * internal data object array of
  39. * elements
  40. *
  41. * @var array
  42. */
  43. public $ipAddressLocation = array();
  44. /**
  45. * constructor
  46. *
  47. * @param Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponseType $response
  48. */
  49. public function __construct(
  50. Zend_Service_DeveloperGarden_Response_IpLocation_LocateIPResponseType $response
  51. ) {
  52. if ($response->ipAddressLocation instanceof Zend_Service_DeveloperGarden_Response_IpLocation_IPAddressLocationType) {
  53. if (is_array($response->ipAddressLocation)) {
  54. foreach ($response->ipAddressLocation as $location) {
  55. $this->ipAddressLocation[] = $location;
  56. }
  57. } else {
  58. $this->ipAddressLocation[] = $response->ipAddressLocation;
  59. }
  60. } elseif (is_array($response->ipAddressLocation)) {
  61. $this->ipAddressLocation = $response->ipAddressLocation;
  62. }
  63. $this->errorCode = $response->getErrorCode();
  64. $this->errorMessage = $response->getErrorMessage();
  65. $this->statusCode = $response->getStatusCode();
  66. $this->statusMessage = $response->getStatusMessage();
  67. }
  68. /**
  69. * implement own parsing mechanism to fix broken wsdl implementation
  70. */
  71. public function parse()
  72. {
  73. parent::parse();
  74. if (is_array($this->ipAddressLocation)) {
  75. foreach ($this->ipAddressLocation as $address) {
  76. $address->parse();
  77. }
  78. } elseif ($this->ipAddressLocation instanceof Zend_Service_DeveloperGarden_Response_IpLocation_IPAddressLocationType) {
  79. $this->ipAddressLocation->parse();
  80. }
  81. return $this;
  82. }
  83. /**
  84. * @return array
  85. */
  86. public function getIpAddressLocation()
  87. {
  88. return $this->ipAddressLocation;
  89. }
  90. }