Code Duplication    Length = 13-16 lines in 3 locations

src/SymmetricCrypt.php 3 locations

@@ 476-489 (lines=14) @@
473
     *
474
     * @return string
475
     */
476
    protected function openSslEncrypt(
477
        string $data,
478
        string $method,
479
        string $password,
480
        int $options,
481
        string $initializationVector
482
    ): string {
483
        $encrypted = $this->openSslEncryptImpl($data, $method, $password, $options, $initializationVector);
484
485
        $message = $this->getErrorMessage();
486
        $encrypted !== false ?: $this->throwException(new CryptException($message));
487
488
        return $encrypted;
489
    }
490
491
    /**
492
     * @param string $data
@@ 500-512 (lines=13) @@
497
     *
498
     * @return string
499
     */
500
    protected function openSslDecrypt(
501
        string $data,
502
        string $method,
503
        string $password,
504
        int $options,
505
        string $initializationVector
506
    ): string {
507
        $decrypted = $this->openSslDecryptImpl($data, $method, $password, $options, $initializationVector);
508
509
        $decrypted !== false ?: $this->throwException(new CryptException($this->getErrorMessage()));
510
511
        return $decrypted;
512
    }
513
514
    /** @noinspection PhpTooManyParametersInspection
515
     * @param string       $data
@@ 564-579 (lines=16) @@
561
     *
562
     * @return string
563
     */
564
    protected function openSslDecryptAuthenticated(
565
        string $data,
566
        string $method,
567
        string $password,
568
        int $options,
569
        string $initializationVector,
570
        string $aad,
571
        string $tag
572
    ): string {
573
        $decrypted = $this
574
            ->openSslDecryptAuthenticatedImpl($data, $method, $password, $options, $initializationVector, $aad, $tag);
575
576
        $decrypted !== false ?: $this->throwException(new CryptException($this->getErrorMessage()));
577
578
        return $decrypted;
579
    }
580
581
    /**
582
     * @param string $method