Base64   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 14
ccs 7
cts 7
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 3 1
A decode() 0 7 2
1
<?php
2
3
namespace kalanis\UploadPerPartes\Target\Local\ContentDecoders;
4
5
6
use kalanis\UploadPerPartes\UploadException;
7
8
9
/**
10
 * Class Base64
11
 * @package kalanis\UploadPerPartes\Target\Local\ContentDecoders
12
 * Decode content from client sent packed in base64
13
 */
14
class Base64 extends ADecoder
15
{
16 1
    public function getMethod(): string
17
    {
18 1
        return 'base64';
19
    }
20
21 2
    public function decode(string $data): string
22
    {
23 2
        $pack = @base64_decode($data, true);
24 2
        if (false === $pack) {
25 1
            throw new UploadException($this->getUppLang()->uppIncomingDataCannotDecode());
26
        }
27 1
        return $pack;
28
    }
29
}
30