Пример #1
0
 /**
  * @param $url
  * @param Operation $operation
  * @param Location|null $location
  * @return CTA
  */
 protected function createCTA($url, Operation $operation, Location $location = null)
 {
     $cta = new CTA();
     $cta->setOperation($operation);
     $cta->setOriginalUrl($url);
     $cta->setExpandedUrl($this->expandUrl($url));
     if ($location) {
         $cta->setLocation($location);
         $cta->setTrackingId($this->generateTrackingId());
         $cta->setTrackingUrl($this->generateTrackingUrl($cta->getExpandedUrl(), $cta->getTrackingId()));
         $cta->setShortenedTrackingUrl($this->getShortenedUrl($cta->getTrackingUrl()));
     }
     return $cta;
 }