ImageToBase64Converter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A convert() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Basster\TwigBase64\Converter;
6
7
use Symfony\Component\Serializer\Exception\ExceptionInterface;
8
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
9
10
/**
11
 * Class ImageToBase64Converter.
12
 */
13
final class ImageToBase64Converter implements FileConverterInterface
14
{
15
    /**
16
     * ImageToBase64Converter constructor.
17
     */
18 2
    public function __construct(private NormalizerInterface $normalizer)
19
    {
20 2
    }
21
22
    /**
23
     * @throws ExceptionInterface
24
     */
25 1
    public function convert(string $imagePath): string
26
    {
27 1
        return (string) $this->normalizer->normalize(new \SplFileObject($imagePath));
28
    }
29
}
30