FormatterService   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 8
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getTXTRecord() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
/**
5
 * This file is part of the mailserver-admin package.
6
 * (c) Jeffrey Boehm <https://github.com/jeboehm/mailserver-admin>
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace App\Service\DKIM;
12
13
class FormatterService
14
{
15
    public function getTXTRecord(string $publicKey, string $algorithm): string
16
    {
17
        $publicKey = preg_replace('#^-+.*?-+$#m', '', $publicKey);
18
        $publicKey = str_replace(["\r", "\n"], '', $publicKey);
19
20
        return sprintf('v=DKIM1\; h=%s\; t=s\; p=%s', $algorithm, $publicKey);
21
    }
22
}
23