Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
307 additions
and
228 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
service_name: travis-pro | ||
repo_token: aHR2Vq500iS9DEQu5bwcAR2rotYnEqMq2 | ||
coverage_clover: tmp/clover.xml | ||
json_path: tmp/coveralls.json |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
vendor/ | ||
composer.lock | ||
.phpunit.result.cache |
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,16 @@ | ||
language: php | ||
php: | ||
- "7.2" | ||
|
||
cache: | ||
directories: | ||
- vendor | ||
|
||
install: | ||
- composer install | ||
|
||
script: | ||
- composer run-script test-all | ||
|
||
after_success: | ||
- travis_retry php vendor/bin/php-coveralls -v |
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
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
<?xml version="1.0"?> | ||
<ruleset> | ||
<rule ref="vendor/zingle-com/php-coding-standard" /> | ||
|
||
<file>./src</file> | ||
</ruleset> |
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,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html --> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.5/phpunit.xsd" | ||
backupGlobals="false" | ||
colors="true" | ||
bootstrap="vendor/autoload.php" | ||
> | ||
<php> | ||
<ini name="error_reporting" value="-1" /> | ||
</php> | ||
|
||
<testsuites> | ||
<testsuite name="Project Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>src</directory> | ||
</whitelist> | ||
</filter> | ||
|
||
<logging> | ||
<log type="coverage-clover" target="tmp/clover.xml" /> | ||
</logging> | ||
</phpunit> |
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,63 @@ | ||
<?php | ||
|
||
namespace Zingle\Infrastructure; | ||
|
||
use phpseclib\Crypt\RSA; | ||
|
||
/** | ||
* Zingle infrastructure user agent. | ||
*/ | ||
class Agent | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $user; | ||
|
||
/** | ||
* @var RSA | ||
*/ | ||
private $key; | ||
|
||
|
||
/** | ||
* Configure agent credentials. | ||
* | ||
* @param string $user | ||
* @param string $keyData | ||
*/ | ||
public function __construct(string $user, string $keyData) | ||
{ | ||
$this->user = $user; | ||
$this->setKey($keyData); | ||
} | ||
|
||
/** | ||
* Return the agent user name. | ||
* | ||
* @return string | ||
*/ | ||
public function getUser(): string | ||
{ | ||
return $this->user; | ||
} | ||
|
||
/** | ||
* Return the agent RSA key. | ||
* | ||
* @return RSA | ||
*/ | ||
public function getKey(): RSA | ||
{ | ||
return $this->key; | ||
} | ||
|
||
/** | ||
* @param string $keyData | ||
*/ | ||
private function setKey(string $keyData): void | ||
{ | ||
$this->key = new RSA(); | ||
$this->key->loadKey($keyData); | ||
} | ||
} |
Oops, something went wrong.