AbstractSessionCoverageListener::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the doyo/behat-code-coverage project.
5
 *
6
 * (c) Anthonius Munthi <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Doyo\Behat\Coverage\Listener;
15
16
use Doyo\Behat\Coverage\Console\ConsoleIO;
17
use Doyo\Bridge\CodeCoverage\Session\SessionInterface;
18
19
class AbstractSessionCoverageListener
20
{
21
    /**
22
     * @var SessionInterface
23
     */
24
    protected $session;
25
26 17
    public function __construct(
27
        SessionInterface $session
28
    ) {
29 17
        $this->session = $session;
30
    }
31
32
    public function renderException(ConsoleIO $consoleIO, SessionInterface $session)
33
    {
34
        if (!$session->hasExceptions()) {
35
            return;
36
        }
37
38
        foreach ($session->getExceptions() as $exception) {
39
            $consoleIO->sessionError($session->getName(), $exception->getMessage());
40
        }
41
    }
42
}
43