Skip to content

Commit

Permalink
Switched to PHP Common Exceptions.
Browse files Browse the repository at this point in the history
Updated readme.
  • Loading branch information
Martin Brecht-Precht committed Apr 26, 2016
1 parent 680a62b commit 0fddba4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ To use Yubico OTP you need YubiCloud access. You can get free API credentials fr
#### Validating a Yubico one time password

```{php}
use CommonException\NetworkException\Base\NetworkException;
$otp = $_POST['otp'];
$userPublicId = 'fetchedFromDatabaseOrSimilar';
Expand All @@ -55,7 +57,7 @@ try {
} else {
// Validation failed
}
} catch (OathServerSuite\Exception\NetworkException $exception) {
} catch (NetworkException $exception) {
// Accessing the YubiCloud webservice failed.
}
```
Expand Down Expand Up @@ -278,6 +280,15 @@ if ($validator->isValid()) {
}
```

---

## Exception handling

PHP Oath Server Suite provides different exceptions – some provided by the PHP Common Exceptions project – for proper handling.
You can find more information about [PHP Common Exceptions at Github](https://github.com/markenwerk/php-common-exceptions).

---

## Contribution

Contributing to our projects is always very appreciated.
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"require": {
"php": ">=5.3",
"lib-curl": "*",
"markenwerk/common-exceptions": "~2.0",
"markenwerk/qr-code-suite": "~3.0",
"enygma/yubikey": "~3.0",
"skleeschulte/base32": "*"
Expand Down
13 changes: 0 additions & 13 deletions src/Exception/NetworkException.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Validation/YubicoOtp/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OathServerSuite\Validation\YubicoOtp;

use OathServerSuite\Exception\NetworkException;
use CommonException\NetworkException\Base\NetworkException;
use OathServerSuite\Exception\ParserException;
use Yubikey\Validate;

Expand Down

0 comments on commit 0fddba4

Please sign in to comment.