fix: more php 8.2 and 8.3 fixes (#6330)
[openemr.git] / src / USPS / USPSAddressVerify.php
bloba01f9058ad8c3e61afcfcf102fcff38519d10388
1 <?php
3 /*
4 * Verify valid address with USPS Web API
5 * originally under MIT License
6 * https://packagist.org/packages/binarydata/usps-php-api
8 * @package OpenEMR
9 * @link https://www.open-emr.org
10 * @author Vincent Gabriel
11 * @author stephen waite <stephen.waite@cmsvt.com>
12 * @copyright Copyright (c) 2012 Vincent Gabriel
13 * @copyright Copyright (c) 2022 stephen waite <stephen.waite@cmsvt.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 namespace OpenEMR\USPS;
19 use OpenEMR\USPS\USPSBase;
20 use OpenEMR\USPS\USPSAddress;
22 /**
23 * USPS Address Verify Class
24 * used to verify an address is valid
25 * @since 1.0
26 * @author Vincent Gabriel
28 class USPSAddressVerify extends USPSBase
30 /**
31 * @var string - the api version used for this type of call
33 protected $apiVersion = 'Verify';
34 /**
35 * @var array - list of all addresses added so far
37 protected $addresses = array();
38 /**
39 * Perform the API call to verify the address
40 * @return string
42 public function verify()
44 return $this->doRequest();
46 /**
47 * returns array of all addresses added so far
48 * @return array
50 public function getPostFields()
52 return $this->addresses;
54 /**
55 * Add Address to the stack
56 * @param USPSAddress object $data
57 * @param string $id the address unique id
58 * @return void
60 public function addAddress(USPSAddress $data, $id = null)
62 $packageId = $id !== null ? $id : ((count($this->addresses) + 1));
63 $this->addresses['Address'][] = array_merge(array('@attributes' => array('ID' => $packageId)), $data->getAddressInfo());