/** * @param string $urlSuffixString * @return string * @throws GetRedirectUrlException */ public function get($urlSuffixString) { $shortenedUrlSuffix = $this->shortenedUrlSuffixRepo->findBySuffix($urlSuffixString); if (null === $shortenedUrlSuffix) { throw new GetRedirectUrlException("Url does not exist"); } $this->registerUrlCallService->register($shortenedUrlSuffix); return $this->urlEncoder->decode($shortenedUrlSuffix->getOriginalUrlEncodedLink()); }
/** * @param array $suffixIds * @return array */ public function getTotalExecutionsByOriginalUrlId(array $suffixIds) { $originalUrlIds = $this->shortenedUrlSuffixRepo->getOriginalUrlIds($suffixIds); $countsById = $this->urlCallRepo->getCallCountsByOriginalUrlId($originalUrlIds); return $countsById; }
/** * @param string $shortened * @return bool */ private function isShortenedUnavailable($shortened) { $entity = $this->shortenedUrlSuffixRepo->findBySuffix($shortened); return null === $entity ? false : true; }