Diagnostics   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 9
dl 0
loc 45
c 1
b 0
f 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setLocale() 0 3 1
A getWarnings() 0 3 1
A getLocale() 0 3 1
A untranslated() 0 3 1
A getUntranslated() 0 3 1
A warning() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * BCKP Translator
7
 * (c) Radovan Kepák
8
 *
9
 * For the full copyright and license information, please view
10
 * the file license.md that was distributed with this source code.
11
 *
12
 * @author Radovan Kepak <[email protected]>
13
 */
14
15
namespace Bckp\Translator\Diagnostics;
16
17
use Bckp\Translator\Interfaces;
18
19
use function array_unique;
20
21
/**
22
 * @api
23
 */
24
class Diagnostics implements Interfaces\Diagnostics
25
{
26
	/** @var string */
27
	private string $locale = '';
28
29
	/** @var array<string> */
30
	private array $messages = [];
31
32
	/** @var array<string> */
33
	private array $untranslated = [];
34
35
	public function getLocale(): string
36
	{
37
		return $this->locale;
38
	}
39
40
	/**
41
	 * @return string[]
42
	 */
43
	public function getUntranslated(): array
44
	{
45
		return array_unique($this->untranslated);
46
	}
47
48
	/**
49
	 * @return string[]
50
	 */
51
	public function getWarnings(): array
52
	{
53
		return array_unique($this->messages);
54
	}
55
56
	#[\Override] public function setLocale(string $locale): void
57
	{
58
		$this->locale = $locale;
59
	}
60
61
	#[\Override] public function untranslated(string $message): void
62
	{
63
		$this->untranslated[] = $message;
64
	}
65
66
	#[\Override] public function warning(string $message): void
67
	{
68
		$this->messages[] = $message;
69
	}
70
}
71