LocalSession::startSession()   A
last analyzed

Complexity

Conditions 2
Paths 3

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

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