Code Duplication    Length = 13-16 lines in 3 locations

src/SymmetricCrypt.php 3 locations

@@ 465-478 (lines=14) @@
462
     *
463
     * @return string
464
     */
465
    protected function openSslEncrypt(
466
        string $data,
467
        string $method,
468
        string $password,
469
        int $options,
470
        string $initializationVector
471
    ): string {
472
        $encrypted = $this->openSslEncryptImpl($data, $method, $password, $options, $initializationVector);
473
474
        $message = $this->getErrorMessage();
475
        $encrypted !== false ?: $this->throwException(new CryptException($message));
476
477
        return $encrypted;
478
    }
479
480
    /**
481
     * @param string $data
@@ 489-501 (lines=13) @@
486
     *
487
     * @return string
488
     */
489
    protected function openSslDecrypt(
490
        string $data,
491
        string $method,
492
        string $password,
493
        int $options,
494
        string $initializationVector
495
    ): string {
496
        $decrypted = $this->openSslDecryptImpl($data, $method, $password, $options, $initializationVector);
497
498
        $decrypted !== false ?: $this->throwException(new CryptException($this->getErrorMessage()));
499
500
        return $decrypted;
501
    }
502
503
    /** @noinspection PhpTooManyParametersInspection
504
     * @param string       $data
@@ 553-568 (lines=16) @@
550
     *
551
     * @return string
552
     */
553
    protected function openSslDecryptAuthenticated(
554
        string $data,
555
        string $method,
556
        string $password,
557
        int $options,
558
        string $initializationVector,
559
        string $aad,
560
        string $tag
561
    ): string {
562
        $decrypted = $this
563
            ->openSslDecryptAuthenticatedImpl($data, $method, $password, $options, $initializationVector, $aad, $tag);
564
565
        $decrypted !== false ?: $this->throwException(new CryptException($this->getErrorMessage()));
566
567
        return $decrypted;
568
    }
569
570
    /**
571
     * @param string $method