| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 9 | final class WithEdge implements EdgeDefinition |
||
| 10 | { |
||
| 11 | private $targetLabel; |
||
| 12 | private $edgeCost; |
||
| 13 | |||
| 14 | private function __construct(string $targetLabel, float $edgeCost) |
||
| 15 | { |
||
| 16 | $this->targetLabel = $targetLabel; |
||
| 17 | $this->edgeCost = $edgeCost; |
||
| 18 | } |
||
| 19 | |||
| 20 | public static function to( |
||
| 25 | } |
||
| 26 | |||
| 27 | public static function toTargets( |
||
| 28 | string $targetLabel, |
||
| 29 | string ...$moreLabels |
||
| 30 | ): EdgeDefinition { |
||
| 31 | $edge = self::to($targetLabel); |
||
| 32 | foreach ($moreLabels as $label) { |
||
| 33 | $edge = $edge->andTo($label); |
||
| 34 | } |
||
| 35 | return $edge; |
||
| 36 | } |
||
| 37 | |||
| 38 | public function andTo(string $target, float $cost = 1.0): EdgeDefinition |
||
| 39 | { |
||
| 40 | return MultipleEdges::consistingOf($this, WithEdge::to($target, $cost)); |
||
| 41 | } |
||
| 42 | |||
| 43 | public function gather(): Edges |
||
| 47 | ); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |