GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ImageService   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 14
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A base64From() 0 11 2
1
<?php
2
3
namespace juniorb2ss\DeathByCaptcha\Services;
4
5
use Intervention\Image\Exception\ImageException;
6
use Intervention\Image\ImageManagerStatic as Image;
7
use juniorb2ss\DeathByCaptcha\Interfaces\ImageInterface;
8
use juniorb2ss\DeathByCaptcha\Exceptions\InvalidCaptchaException;
9
10
class ImageService implements ImageInterface
11
{
12 15
    public static function base64From(string $content): string
13
    {
14
        try {
15 15
            $img = Image::make($content)->encode('data-url');
16 12
            $base64 = substr($img->encoded, 22);
17
18 12
            return 'base64:' . $base64;
19 3
        } catch (ImageException $e) {
20 3
            throw new InvalidCaptchaException;
21
        }
22
    }
23
}
24