Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
33.33% covered (danger)
33.33%
1 / 3
33.33% covered (danger)
33.33%
1 / 3
50.00% covered (danger)
50.00%
1 / 2
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Lang
33.33% covered (danger)
33.33%
1 / 3
33.33% covered (danger)
33.33%
1 / 3
50.00% covered (danger)
50.00%
1 / 2
0.00% covered (danger)
0.00%
0 / 1
2.50
0.00% covered (danger)
0.00%
0 / 1
 fromString
33.33% covered (danger)
33.33%
1 / 3
33.33% covered (danger)
33.33%
1 / 3
50.00% covered (danger)
50.00%
1 / 2
0.00% covered (danger)
0.00%
0 / 1
2.50
1<?php
2
3namespace App\Enum;
4
5/**
6 * @author Wilhelm Zwertvaegher
7 */
8enum Lang: string implements Enum
9{
10    case FR = 'fr';
11    case EN = 'en';
12
13    public static function fromString(string $value): Enum
14    {
15        try {
16            return self::from(strtolower($value));
17        } catch (\Throwable $throwable) {
18            return self::FR;
19        }
20    }
21}

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.

Lang->fromString
13    public static function fromString(string $value): Enum
14    {
15        try {
16            return self::from(strtolower($value));
17        } catch (\Throwable $throwable) {
18            return self::FR;
19        }
20    }