SuiteTests::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Copyright (c) 2017 Francois-Xavier Soubirou.
5
 *
6
 * This file is part of ci-report.
7
 *
8
 * ci-report is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * ci-report is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with ci-report. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
declare(strict_types=1);
22
23
namespace App\Util;
24
25
use App\DTO\SuiteDTO;
26
use App\DTO\TestDTO;
27
28
/**
29
 * Suite and tests container class.
30
 *
31
 * @category  ci-report app
32
 *
33
 * @author    Francois-Xavier Soubirou <[email protected]>
34
 * @copyright 2017 Francois-Xavier Soubirou
35
 * @license   http://www.gnu.org/licenses/   GPLv3
36
 *
37
 * @see      https://www.ci-report.io
38
 */
39
class SuiteTests
40
{
41
    /**
42
     * @var SuiteDTO
43
     */
44
    private $suite;
45
46
    /**
47
     * @var array
48
     */
49
    private $tests = array();
50
51
    /**
52
     * Constructor.
53
     *
54
     * @param SuiteDTO $suite The suite
55
     */
56
    public function __construct(SuiteDTO $suite)
57
    {
58
        $this->setSuite($suite);
59
    }
60
61
    /**
62
     * Set suite.
63
     *
64
     * @param SuiteDTO $suite
65
     *
66
     * @return SuiteTests
67
     */
68
    public function setSuite(SuiteDTO $suite): self
69
    {
70
        $this->suite = $suite;
71
72
        return $this;
73
    }
74
75
    /**
76
     * Get suite.
77
     *
78
     * @return SuiteDTO
79
     */
80
    public function getSuite(): SuiteDTO
81
    {
82
        return $this->suite;
83
    }
84
85
    /**
86
     * Set tests.
87
     *
88
     * @param array $tests Array of tests
89
     *
90
     * @return SuiteTests
91
     */
92
    public function setTests(array $tests): self
93
    {
94
        $this->tests = $tests;
95
96
        return $this;
97
    }
98
99
    /**
100
     * Get tests.
101
     *
102
     * @return array
103
     */
104
    public function getTests(): array
105
    {
106
        return $this->tests;
107
    }
108
109
    /**
110
     * Add a test.
111
     *
112
     * @param TestDTO $test Test object
113
     *
114
     * @return SuiteTests
115
     */
116
    public function addTest(TestDTO $test): self
117
    {
118
        $this->tests[] = $test;
119
120
        return $this;
121
    }
122
}
123