Completed
Push — develop ( 2faf16...be2583 )
by ANTHONIUS
15s queued 11s
created

LocalSession::startSession()   A

Complexity

Conditions 2
Paths 3

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 3
nop 1
dl 0
loc 11
ccs 9
cts 9
cp 1
crap 2
rs 9.9666
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the doyo/behat-coverage-extension 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\Bridge\CodeCoverage\Session;
15
16
class LocalSession extends Session
17
{
18 8
    public static function startSession($name): bool
19
    {
20 1
        $self = new static($name);
21
        try{
22 1
            $self->start();
23 8
            register_shutdown_function([$self, 'shutdown']);
24 8
            return true;
25 1
        }catch (\Exception $exception){
26 1
            $self->addException($exception);
27 1
            $self->save();
28 1
            return false;
29
        }
30
    }
31
}
32