Base64Trait   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 17
ccs 5
cts 6
cp 0.8333
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A validateBase64() 0 7 2
1
<?php
2
3
4
namespace Webcore\Validation\Rules;
5
6
7
use Webcore\Validation\AbstractRuleTrait;
8
9
trait Base64Trait
10
{
11
    use AbstractRuleTrait;
12
13
    /**
14
     * Allowed characters: A-Z, a-z, 0-9, +, /, =
15
     *
16
     * @param $value
17
     */
18 16
    private function validateBase64($value)
19
    {
20 16
        $isNotValid = base64_decode($value, true) === false;
21 16
        if ($isNotValid) {
22 8
            $this->throwInvalidArgumentMustBe("valid base_64");
23
        }
24 8
    }
25
}
26