Skip to content

Commit 3e2d718

Browse files
committed
Namespaced objects and started composer compatibility setup
1 parent d7271d1 commit 3e2d718

14 files changed

+53
-43
lines changed

USPSAddress.php renamed to USPS/USPSAddress.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
namespace USPS;
3+
24
/**
35
* USPS Address Class
46
* used across other class to create addresses represented as objects

USPSAddressVerify.php renamed to USPS/USPSAddressVerify.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
namespace USPS;
3+
24
/**
35
* Load required classes
46
*/

USPSBase.php renamed to USPS/USPSBase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('XMLParser.php');
2+
namespace USPS;
3+
4+
use Utility\Parsers\XMLParser;
5+
66
/**
77
* USPS Base class
88
* used to perform the actual api calls

USPSCityStateLookup.php renamed to USPS/USPSCityStateLookup.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
3+
64
/**
75
* USPS City/State lookup
86
* used to find a city/state by a zipcode lookup

USPSFirstClassServiceStandards.php renamed to USPS/USPSFirstClassServiceStandards.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
63

74
/**
85
*/

USPSInternationalLabel.php renamed to USPS/USPSInternationalLabel.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
63

74
/**
85
*/

USPSOpenDistributeLabel.php renamed to USPS/USPSOpenDistributeLabel.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
63

74
/**
85
*/

USPSPriorityLabel.php renamed to USPS/USPSPriorityLabel.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
63

74
/**
85
*/

USPSRate.php renamed to USPS/USPSRate.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
3+
64
/**
75
* USPS Rate calculator class
86
* used to get a rate for shipping methods

USPSServiceDeliveryCalculator.php renamed to USPS/USPSServiceDeliveryCalculator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
63

74
/**
85
*/

USPSTrackConfirm.php renamed to USPS/USPSTrackConfirm.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
2+
namespace USPS;
63

74
/**
85
*/

USPSZipCodeLookup.php renamed to USPS/USPSZipCodeLookup.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
<?php
2-
/**
3-
* Load required classes
4-
*/
5-
require_once('USPSBase.php');
6-
require_once('USPSAddress.php');
2+
namespace USPS;
3+
74
/**
85
* USPS Zip code lookup by city/state
96
* used to find a zip code by city/state lookup
@@ -33,10 +30,13 @@ public function lookup() {
3330
public function getPostFields() {
3431
return $this->addresses;
3532
}
33+
3634
/**
3735
* Add Address to the stack
38-
* @param USPSAddress object $data
39-
* @param string $id the address unique id
36+
*
37+
* @param \USPS\USPSAddress $data
38+
* @param string $id the address unique id
39+
*
4040
* @return void
4141
*/
4242
public function addAddress(USPSAddress $data, $id=null) {

XMLParser.php renamed to Utility/Parsers/XMLParser.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?php
2+
namespace Utility\Parsers;
3+
24
/**
35
* Array2XML: A class to convert array in PHP to XML
46
* It also takes into account attributes names unlike SimpleXML in PHP

composer.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "pingdevelopment/usps-php-api",
3+
"type": "library",
4+
"description": "PHP wrapper for USPS Web Tools API",
5+
"keywords": ["usps", "api"],
6+
"authors": [
7+
{
8+
"name": "Vincent Gabriel",
9+
"homepage": "http://vadimg.com",
10+
"role": "Developer"
11+
},
12+
{
13+
"name": "Peter Adams",
14+
"homepage": "https://www.pingdevelopment.com",
15+
"role": "Developer"
16+
}
17+
],
18+
"require": {
19+
"php": ">=5.3.0"
20+
},
21+
"autoload": {
22+
"psr-0": {
23+
"USPS": "/"
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)