Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of PHPUnit.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace PHPUnit\TextUI\XmlConfiguration\Logging;
11
 
12
use PHPUnit\TextUI\XmlConfiguration\Exception;
13
use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Html as TestDoxHtml;
14
use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Text as TestDoxText;
15
use PHPUnit\TextUI\XmlConfiguration\Logging\TestDox\Xml as TestDoxXml;
16
 
17
/**
18
 * @internal This class is not covered by the backward compatibility promise for PHPUnit
19
 *
20
 * @psalm-immutable
21
 */
22
final class Logging
23
{
24
    /**
25
     * @var ?Junit
26
     */
27
    private $junit;
28
 
29
    /**
30
     * @var ?Text
31
     */
32
    private $text;
33
 
34
    /**
35
     * @var ?TeamCity
36
     */
37
    private $teamCity;
38
 
39
    /**
40
     * @var ?TestDoxHtml
41
     */
42
    private $testDoxHtml;
43
 
44
    /**
45
     * @var ?TestDoxText
46
     */
47
    private $testDoxText;
48
 
49
    /**
50
     * @var ?TestDoxXml
51
     */
52
    private $testDoxXml;
53
 
54
    public function __construct(?Junit $junit, ?Text $text, ?TeamCity $teamCity, ?TestDoxHtml $testDoxHtml, ?TestDoxText $testDoxText, ?TestDoxXml $testDoxXml)
55
    {
56
        $this->junit       = $junit;
57
        $this->text        = $text;
58
        $this->teamCity    = $teamCity;
59
        $this->testDoxHtml = $testDoxHtml;
60
        $this->testDoxText = $testDoxText;
61
        $this->testDoxXml  = $testDoxXml;
62
    }
63
 
64
    public function hasJunit(): bool
65
    {
66
        return $this->junit !== null;
67
    }
68
 
69
    public function junit(): Junit
70
    {
71
        if ($this->junit === null) {
72
            throw new Exception('Logger "JUnit XML" is not configured');
73
        }
74
 
75
        return $this->junit;
76
    }
77
 
78
    public function hasText(): bool
79
    {
80
        return $this->text !== null;
81
    }
82
 
83
    public function text(): Text
84
    {
85
        if ($this->text === null) {
86
            throw new Exception('Logger "Text" is not configured');
87
        }
88
 
89
        return $this->text;
90
    }
91
 
92
    public function hasTeamCity(): bool
93
    {
94
        return $this->teamCity !== null;
95
    }
96
 
97
    public function teamCity(): TeamCity
98
    {
99
        if ($this->teamCity === null) {
100
            throw new Exception('Logger "Team City" is not configured');
101
        }
102
 
103
        return $this->teamCity;
104
    }
105
 
106
    public function hasTestDoxHtml(): bool
107
    {
108
        return $this->testDoxHtml !== null;
109
    }
110
 
111
    public function testDoxHtml(): TestDoxHtml
112
    {
113
        if ($this->testDoxHtml === null) {
114
            throw new Exception('Logger "TestDox HTML" is not configured');
115
        }
116
 
117
        return $this->testDoxHtml;
118
    }
119
 
120
    public function hasTestDoxText(): bool
121
    {
122
        return $this->testDoxText !== null;
123
    }
124
 
125
    public function testDoxText(): TestDoxText
126
    {
127
        if ($this->testDoxText === null) {
128
            throw new Exception('Logger "TestDox Text" is not configured');
129
        }
130
 
131
        return $this->testDoxText;
132
    }
133
 
134
    public function hasTestDoxXml(): bool
135
    {
136
        return $this->testDoxXml !== null;
137
    }
138
 
139
    public function testDoxXml(): TestDoxXml
140
    {
141
        if ($this->testDoxXml === null) {
142
            throw new Exception('Logger "TestDox XML" is not configured');
143
        }
144
 
145
        return $this->testDoxXml;
146
    }
147
}