| Conditions | 3 |
| Paths | 2 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 4 | public function deleteByShortCode(string $shortCode, bool $ignoreThreshold = false): void |
|
| 35 | { |
||
| 36 | 4 | $shortUrl = $this->findByShortCode($this->em, $shortCode); |
|
| 37 | 4 | if (! $ignoreThreshold && $this->isThresholdReached($shortUrl)) { |
|
| 38 | 1 | throw Exception\DeleteShortUrlException::fromVisitsThreshold( |
|
| 39 | 1 | $this->deleteShortUrlsOptions->getVisitsThreshold(), |
|
| 40 | 1 | $shortUrl->getShortCode() |
|
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 44 | 3 | $this->em->remove($shortUrl); |
|
| 45 | 3 | $this->em->flush(); |
|
| 46 | 3 | } |
|
| 47 | |||
| 57 |