/** * @param ShortenedUrlSuffix $suffix * @param array $totalExecutionsByOriginalUrlId * @return int */ private function getOriginalUrlExecutionCount(ShortenedUrlSuffix $suffix, array $totalExecutionsByOriginalUrlId) { $originalUrlId = $suffix->getOriginalUrlId(); return isset($totalExecutionsByOriginalUrlId[$originalUrlId]) ? $totalExecutionsByOriginalUrlId[$originalUrlId] : 0; }
/** * @param ShortenedUrlSuffix $shortenedUrlSuffix * @param int $totalExecutions * @param int $totalRedirectsToSameContent * @return ShortenedUrl */ public function create(ShortenedUrlSuffix $shortenedUrlSuffix, $totalExecutions, $totalRedirectsToSameContent) { $link = $this->localUrlAssembler->assemble($shortenedUrlSuffix->getSuffixString()); $originalLink = $this->urlEncoder->decode($shortenedUrlSuffix->getOriginalUrlEncodedLink()); return new ShortenedUrl($link, $originalLink, $shortenedUrlSuffix->getDateCreated(), $totalExecutions, $totalRedirectsToSameContent); }