Test Failed
Branch master (b41ac8)
by John
03:12
created

ACipher::getPaddedText()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Encryption\Cipher;
6
7
8
abstract class ACipher
0 ignored issues
show
Coding Style introduced by
ACipher does not seem to conform to the naming convention (^Abstract|Factory$).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
9
{
10
    public const BLOCK_SIZE = 0;
11
    public const IV_LENGTH = 0;
12
    public const CIPHER = 'abstract';
13
14 2
    public function getName(): string
15
    {
16 2
        return static::CIPHER;
17
    }
18
19 77
    protected function getPaddedText(string $plainText, int $blockSize): string
20
    {
21 77
        $stringLength = strlen($plainText);
22 77
        if ($stringLength % $blockSize) {
23 77
            $plainText = str_pad($plainText, $stringLength + $blockSize - $stringLength % $blockSize, "\0");
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $plainText. This often makes code more readable.
Loading history...
24
        }
25 77
        return $plainText;
26
    }
27
}
28