-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #89 from hervehobbes/master
Added NFC support
- Loading branch information
Showing
5 changed files
with
210 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Passbook package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Passbook\Pass; | ||
|
||
/** | ||
* NFC | ||
*/ | ||
class Nfc implements NfcInterface | ||
{ | ||
/** | ||
* NFC message | ||
* @var string | ||
*/ | ||
protected $message = ''; | ||
|
||
/** | ||
* Encryption Public Key | ||
* @var string | ||
*/ | ||
protected $encryptionPublicKey = ''; | ||
|
||
public function __construct($message, $encryptionPublicKey) | ||
{ | ||
$this->setMessage($message); | ||
$this->setEncryptionPublicKey($encryptionPublicKey); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setMessage($message) | ||
{ | ||
$this->message = $message; | ||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setEncryptionPublicKey($encryptionPublicKey) | ||
{ | ||
$this->encryptionPublicKey = $encryptionPublicKey; | ||
return $this; | ||
} | ||
|
||
public function toArray() | ||
{ | ||
$array = [ | ||
'message' => $this->getMessage(), | ||
'encryptionPublicKey' => $this->getEncryptionPublicKey() | ||
]; | ||
return $array; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getMessage() | ||
{ | ||
return $this->message; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getEncryptionPublicKey() | ||
{ | ||
return $this->encryptionPublicKey; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Passbook package. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Passbook\Pass; | ||
|
||
use Passbook\ArrayableInterface; | ||
|
||
/** | ||
* NfcInterface | ||
*/ | ||
interface NfcInterface extends ArrayableInterface | ||
{ | ||
/** | ||
* Sets NFC message | ||
* | ||
* @param string | ||
*/ | ||
public function setMessage($message); | ||
|
||
/** | ||
* Gets NFC message | ||
* | ||
* @return string | ||
*/ | ||
public function getMessage(); | ||
|
||
/** | ||
* Sets encryption Public Key | ||
* | ||
* @param string | ||
*/ | ||
public function setEncryptionPublicKey($encryptionPublicKey); | ||
|
||
/** | ||
* Gets encryptionPublicKey | ||
* | ||
* @return string | ||
*/ | ||
public function getEncryptionPublicKey(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters