| Conditions | 6 |
| Paths | 10 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function __construct(Line ...$lines) |
||
| 18 | { |
||
| 19 | $this->lines = new Set($lines); |
||
| 20 | $this->points = new Set(); |
||
| 21 | $this->linesByPoint = new Map(); |
||
| 22 | |||
| 23 | foreach ($lines as $line) { |
||
| 24 | /** @var CartesianCoordinate $point */ |
||
| 25 | foreach ($line->pointsIterator() as $point) { |
||
| 26 | if (!$this->points->contains($point)) { |
||
| 27 | $this->points->add($point); |
||
| 28 | } |
||
| 29 | |||
| 30 | if (!$this->linesByPoint->hasKey($point)) { |
||
| 31 | $this->linesByPoint->put($point, new Set()); |
||
| 32 | } |
||
| 33 | |||
| 34 | if (!$this->linesByPoint->get($point)->contains($line)) { |
||
| 35 | $this->linesByPoint->get($point)->add($line); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 | |||
| 41 | } |