Skip to content

Commit 4f9566c

Browse files
committed
Code style, doc-blocks and clean-up
1 parent e0e637a commit 4f9566c

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@ composer.phar
22
/vendor/
33
/private/
44
/tests/functional/*.pdf
5-
6-
# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
7-
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
8-
# composer.lock

signed-and-timestamped.pdf

-155 KB
Binary file not shown.

signed.pdf

-154 KB
Binary file not shown.

src/SignatureModule.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(
5858
/**
5959
* @return string
6060
*/
61-
public function getCertificate()
61+
public function getCertificate(): string
6262
{
6363
return $this->identity->getSigningCertificate();
6464
}
@@ -77,7 +77,7 @@ public function createSignature(\SetaPDF_Core_Reader_FilePath $tmpPath): string
7777
$this->module->setExtraCertificates([$this->client->getCertificatePath()]);
7878

7979
// For backwards compatibility
80-
if (method_exists($this->module, 'setOcspResponse')) {
80+
if (\method_exists($this->module, 'setOcspResponse')) {
8181
$this->module->setOcspResponse($this->identity->getOcspResponse());
8282
} else {
8383
$this->addOcspResponse();
@@ -93,9 +93,12 @@ public function createSignature(\SetaPDF_Core_Reader_FilePath $tmpPath): string
9393

9494
/**
9595
* Adds the OCSP response as a signed attribute in the CMS container.
96+
*
97+
* @throws \SetaPDF_Signer_Exception
9698
*/
9799
protected function addOcspResponse(): void
98100
{
101+
/** @var \SetaPDF_Signer_Asn1_Element $cms */
99102
$cms = $this->module->getCms();
100103
$signerInfos = \SetaPDF_Signer_Asn1_Element::findByPath('1/0/4', $cms);
101104
if (($signerInfos->getIdent() & "\xA1") === "\xA1") {

src/TimestampModule.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ class TimestampModule implements
2424
*/
2525
protected $identity;
2626

27+
/**
28+
* @param Client $client
29+
*/
2730
public function __construct(Client $client)
2831
{
2932
$this->client = $client;
@@ -50,7 +53,7 @@ public function createTimestamp($data)
5053
* @param string|\SetaPDF_Core_Reader_FilePath $data The hash of the main signature
5154
* @return string
5255
*/
53-
protected function getHash($data)
56+
protected function getHash($data): string
5457
{
5558
if ($data instanceof \SetaPDF_Core_Reader_FilePath) {
5659
return \hash_file('sha256', $data->getPath());

0 commit comments

Comments
 (0)