@@ -50,8 +50,9 @@ public function sign(JSignParam $params): string
5050
5151 return $ fileSigned ;
5252 } catch (Throwable $ e ) {
53- if ($ params ->getTempPath ())
53+ if ($ params ->getTempPath ()) {
5454 $ this ->fileService ->deleteTempFiles ($ params ->getTempPath (), $ params ->getTempName ());
55+ }
5556
5657 throw new Exception ($ e ->getMessage ());
5758 }
@@ -66,8 +67,7 @@ private function repackCertificateIfPasswordIsUnicode(
6667 JSignParam $ params ,
6768 \OpenSSLCertificate |string $ cert ,
6869 \OpenSSLAsymmetricKey |\OpenSSLCertificate |string $ pkey ,
69- ): void
70- {
70+ ): void {
7171 $ detectedEncodingString = mb_detect_encoding ($ params ->getPassword (), 'ASCII ' , true );
7272 if ($ detectedEncodingString === false ) {
7373 $ password = md5 (microtime ());
@@ -132,7 +132,7 @@ private function storeTempFiles(JSignParam $params): array
132132
133133 private function commandSign (JSignParam $ params ): string
134134 {
135- list ($ pdf , $ certificate ) = $ this ->storeTempFiles ($ params );
135+ list ($ pdf , $ certificate ) = $ this ->storeTempFiles ($ params );
136136 $ java = $ this ->javaCommand ($ params );
137137 $ jSignPdf = $ this ->getjSignPdfJarPath ($ params );
138138
@@ -154,8 +154,9 @@ private function getjSignPdfJarPath(JSignParam $params): string
154154
155155 private function throwIf (bool $ condition , string $ message ): void
156156 {
157- if ($ condition )
157+ if ($ condition ) {
158158 throw new Exception ($ message );
159+ }
159160 }
160161
161162 private function isPasswordCertificateValid (JSignParam $ params ): bool
@@ -221,14 +222,14 @@ private function safeExec(
221222 string $ tempEncriptedOriginal ,
222223 string $ tempDecrypted ,
223224 string $ tempEncriptedRepacked ,
224- ): void
225- {
225+ ): void {
226226 $ tempPassword = escapeshellarg ($ tempPassword );
227227 $ tempEncriptedOriginal = escapeshellarg ($ tempEncriptedOriginal );
228228 $ tempDecrypted = escapeshellarg ($ tempDecrypted );
229229 $ tempEncriptedRepacked = escapeshellarg ($ tempEncriptedRepacked );
230230
231- exec (<<<REPACK_COMMAND
231+ exec (
232+ <<<REPACK_COMMAND
232233 cat $ tempPassword | openssl pkcs12 -legacy -in $ tempEncriptedOriginal -nodes -out $ tempDecrypted -passin stdin &&
233234 cat $ tempPassword | openssl pkcs12 -in $ tempDecrypted -export -out $ tempEncriptedRepacked -passout stdin
234235 REPACK_COMMAND
0 commit comments