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.

ConstantTranslator   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A withTranslation() 0 3 1
A translate() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Marcosh\PhpValidationDSL\Translator;
6
7
final class ConstantTranslator implements Translator
8
{
9
    /**
10
     * @var string
11
     */
12
    private $translation;
13
14
    private function __construct(string $translation)
15
    {
16
        $this->translation = $translation;
17
    }
18
19
    public static function withTranslation(string $translation): self
20
    {
21
        return new self($translation);
22
    }
23
24
    public function translate(string $string): string
25
    {
26
        return $this->translation;
27
    }
28
}
29