NoPossibleSolution   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 7
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A to() 0 5 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\PuzzleSolver;
4
5
use RuntimeException;
6
use function sprintf;
7
8
/**
9
 * No Possible Solution
10
 *
11
 * Exception thrown when the solver could not find any solutions to the puzzle,
12
 * which usually means the puzzle has no solution and can be considered
13
 * "impossible".
14
 *
15
 * @author Stratadox
16
 */
17
final class NoPossibleSolution extends RuntimeException implements NoSolution
18
{
19
    public static function to(Puzzle $puzzle): self
20
    {
21
        return new self(sprintf(
22
            'No solution was found to the puzzle `%s`',
23
            $puzzle->representation()
24
        ));
25
    }
26
}
27