Fix PHP 5 compat in CertificateStore

This commit is contained in:
Niklas Keller
2016-03-15 13:21:44 +01:00
parent 19bc2af47d
commit 6bfa882aa0

View File

@@ -2,6 +2,7 @@
namespace Kelunik\AcmeClient\Stores;
use Amp\CoroutineResult;
use Amp\File\FilesystemException;
use InvalidArgumentException;
use Kelunik\Certificate\Certificate;
@@ -26,7 +27,8 @@ class CertificateStore {
Assert::string($name, "Name must be a string. Got: %s");
try {
return yield \Amp\File\get($this->root . "/" . $name . "/cert.pem");
$contents = (yield \Amp\File\get($this->root . "/" . $name . "/cert.pem"));
yield new CoroutineResult($contents);
} catch (FilesystemException $e) {
throw new CertificateStoreException("Failed to load certificate.", 0, $e);
}
@@ -88,4 +90,4 @@ class CertificateStore {
yield \Amp\File\rmdir($this->root . "/" . $name);
}
}
}