/**
  * Generates and appends the Resource Url to the Links array
  *
  * @return void
  */
 protected function addLinkUrl($annotation, $entity)
 {
     $uri = $this->host ?: $this->request->getSchemeAndHost();
     $uri .= ltrim($this->prefix, '/') ?: null;
     $params = [];
     foreach ($annotation->params as $key => $method) {
         if (method_exists($entity, $method)) {
             $params["{{$key}}"] = $entity->{$method}();
         }
     }
     $href = str_replace(array_keys($params), $params, $annotation->href);
     if ($annotation->type == "embedded") {
         if (!empty($this->links['self']['href'])) {
             $uri = $this->links['self']['href'];
         } else {
             $uri .= str_replace([$this->prefix, ltrim($href, '/')], '', $this->request->getPathInfo());
         }
     }
     $this->links[$annotation->name] = ['href' => preg_replace('/([^:])(\\/{2,})/', '$1/', $uri . str_replace('//', '/', $href))];
 }