Passed
Pull Request — master (#282)
by Théo
02:30
created

ConfigurationLogger::addWarning()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the box project.
7
 *
8
 * (c) Kevin Herrera <[email protected]>
9
 *     Théo Fidry <[email protected]>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14
15
namespace KevinGH\Box;
16
17
use Assert\Assertion;
18
use function array_keys;
19
use function trim;
20
21
final class ConfigurationLogger
22
{
23
    private $recommendations = [];
24
    private $warnings = [];
25
26
    public function addRecommendation(string $message): void
27
    {
28
        $message = trim($message);
29
30
        Assertion::false('' === $message, 'Expected to have a message but a blank string was given instead.');
31
32
        $this->recommendations[$message] = $message;
33
    }
34
35
    public function addWarning(string $message): void
36
    {
37
        $message = trim($message);
38
39
        Assertion::false('' === $message, 'Expected to have a message but a blank string was given instead.');
40
41
        $this->warnings[$message] = $message;
42
    }
43
44
    /**
45
     * @return string[]
46
     */
47
    public function getRecommendations(): array
48
    {
49
        return array_keys($this->recommendations);
50
    }
51
52
    /**
53
     * @return string[]
54
     */
55
    public function getWarnings(): array
56
    {
57
        return array_keys($this->warnings);
58
    }
59
}
60