Skip to content

Commit 48d9401

Browse files
committed
Merge pull request #1 from skl/master
Create Exception class for package
2 parents a5544a6 + 7474f56 commit 48d9401

6 files changed

Lines changed: 21 additions & 4 deletions

File tree

src/Dfcplc/PostcodeAnywhere/BankValidation/Validate.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace Dfcplc\PostcodeAnywhere\BankValidation;
33

4+
use Dfcplc\PostcodeAnywhere\Exception;
5+
46
class Validate
57
{
68

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace Dfcplc\PostcodeAnywhere;
4+
5+
class Exception extends \Exception
6+
{
7+
}

src/Dfcplc/PostcodeAnywhere/InternationalBankValidation/Validate.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace Dfcplc\PostcodeAnywhere\InternationalBankValidation;
33

4+
use Dfcplc\PostcodeAnywhere\Exception;
5+
46
class Validate
57
{
68

@@ -28,7 +30,7 @@ public function MakeRequest()
2830
//Check for an error, if there is one then throw an exception
2931
if ($file->Columns->Column->attributes()->Name == "Error")
3032
{
31-
throw new \Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
33+
throw new Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
3234
}
3335

3436
//Copy the data

src/Dfcplc/PostcodeAnywhere/PostcodeAnywhere/Find.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace Dfcplc\PostcodeAnywhere\PostcodeAnywhere;
33

4+
use Dfcplc\PostcodeAnywhere\Exception;
5+
46
class Lookup
57
{
68
private $Key; //The key to use to authenticate to the service.
@@ -43,7 +45,7 @@ public function MakeRequest()
4345
//Check for an error, if there is one then throw an exception
4446
if ($file->Columns->Column->attributes()->Name == "Error")
4547
{
46-
throw new \Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
48+
throw new Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
4749
}
4850

4951
//Copy the data

src/Dfcplc/PostcodeAnywhere/PostcodeAnywhere/FindByParts.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace Dfcplc\PostcodeAnywhere\PostcodeAnywhere;
33

4+
use Dfcplc\PostcodeAnywhere\Exception;
5+
46
class FindByParts
57
{
68
//Credit: Thanks to Stuart Sillitoe (http://stu.so/me) for the original PHP that these samples are based on.
@@ -42,7 +44,7 @@ public function MakeRequest()
4244
//Check for an error, if there is one then throw an exception
4345
if ($file->Columns->Column->attributes()->Name == "Error")
4446
{
45-
throw new \Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
47+
throw new Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
4648
}
4749

4850
//Copy the data

src/Dfcplc/PostcodeAnywhere/PostcodeAnywhere/Retrieve.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22
namespace Dfcplc\PostcodeAnywhere\PostcodeAnywhere;
33

4+
use Dfcplc\PostcodeAnywhere\Exception;
5+
46
class Retrieve
57
{
68
//Credit: Thanks to Stuart Sillitoe (http://stu.so/me) for the original PHP that these samples are based on.
@@ -27,7 +29,7 @@ public function MakeRequest()
2729
//Check for an error, if there is one then throw an exception
2830
if ($file->Columns->Column->attributes()->Name == "Error")
2931
{
30-
throw new \Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
32+
throw new Exception("[ID] " . $file->Rows->Row->attributes()->Error . " [DESCRIPTION] " . $file->Rows->Row->attributes()->Description . " [CAUSE] " . $file->Rows->Row->attributes()->Cause . " [RESOLUTION] " . $file->Rows->Row->attributes()->Resolution);
3133
}
3234

3335
//Copy the data

0 commit comments

Comments
 (0)