Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ConnectionFailed
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 from
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Celema\Quma\Exception;
6
7use PDOException;
8
9/** @api */
10final class ConnectionFailed extends PDOException
11{
12    public static function from(PDOException $e): self
13    {
14        $failure = new self('Could not connect to the database: ' . $e->getMessage(), previous: $e);
15        $failure->code = $e->getCode();
16        $failure->errorInfo = $e->errorInfo;
17
18        return $failure;
19    }
20}

Branches

Below are the source code lines that represent each code branch as identified by Xdebug. Please note a branch is not necessarily coterminous with a line, a line may contain multiple branches and therefore show up more than once. Please also be aware that some branches may be implicit rather than explicit, e.g. an if statement always has an else as part of its logical flow even if you didn't write one.

ConnectionFailed->from
12    public static function from(PDOException $e): self
13    {
14        $failure = new self('Could not connect to the database: ' . $e->getMessage(), previous: $e);
15        $failure->code = $e->getCode();
16        $failure->errorInfo = $e->errorInfo;
17
18        return $failure;
19    }