PuzzleDescription   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 46
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A heuristic() 0 3 1
A isWeightedMoves() 0 3 1
A __construct() 0 10 1
A singleSolution() 0 3 1
A isExhausting() 0 3 1
A onlyBest() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\PuzzleSolver;
4
5
/**
6
 * Puzzle Description
7
 *
8
 * Value object used to describe some core characteristics of the puzzle to
9
 * solve; contains information about the kind and number of solutions we're
10
 * looking for, whether the moves could turn in circles, whether all moves are
11
 * of equal cost, etc.
12
 *
13
 * @author Stratadox
14
 */
15
final class PuzzleDescription
16
{
17
    /** @var Find */
18
    private $goal;
19
    /** @var bool */
20
    private $weightedMoves;
21
    /** @var bool */
22
    private $exhausting;
23
    /** @var Heuristic|null */
24
    private $heuristic;
25
26
    public function __construct(
27
        Find $goal,
28
        bool $weightedMoves,
29
        bool $exhausting,
30
        ?Heuristic $heuristic
31
    ) {
32
        $this->goal = $goal;
33
        $this->weightedMoves = $weightedMoves;
34
        $this->exhausting = $exhausting;
35
        $this->heuristic = $heuristic;
36
    }
37
38
    public function isWeightedMoves(): bool
39
    {
40
        return $this->weightedMoves;
41
    }
42
43
    public function isExhausting(): bool
44
    {
45
        return $this->exhausting;
46
    }
47
48
    public function heuristic(): ?Heuristic
49
    {
50
        return $this->heuristic;
51
    }
52
53
    public function singleSolution(): bool
54
    {
55
        return $this->goal->singleSolution();
56
    }
57
58
    public function onlyBest(): bool
59
    {
60
        return $this->goal->onlyBest();
61
    }
62
}
63