/**
  * @param int|Post $postId
  *
  * @return string
  *
  * @throws \UnexpectedValueException
  */
 public function getPermalink($postId)
 {
     $post = $postId instanceof Post ? $postId : $this->postManager->find($postId);
     if (!$post) {
         throw new \UnexpectedValueException(sprintf('No post with ID "%d"', $postId));
     }
     $permalinkStructure = $this->optionExtension->getOption('permalink_structure', '')->getValue();
     return $this->replacePostArguments($permalinkStructure, $post);
 }
 /**
  * @param int|Post $postId     A Wordpress post identifier
  * @param bool     $isAbsolute Determines if you want to retrieve an absolute URL
  *
  * @return string
  *
  * @throws \UnexpectedValueException
  */
 public function getPermalink($postId, $isAbsolute = false)
 {
     $post = $postId instanceof Post ? $postId : $this->postManager->find($postId);
     if (!$post) {
         throw new \UnexpectedValueException(sprintf('No post with ID "%d"', $postId));
     }
     $permalinkStructure = $this->optionExtension->getOption('permalink_structure', '')->getValue();
     $relativeUrl = $this->replacePostArguments($permalinkStructure, $post);
     if ($isAbsolute) {
         $home = $this->optionExtension->getOption('home');
         return rtrim($home->getValue(), '/') . '/' . ltrim($relativeUrl, '/');
     }
     return $relativeUrl;
 }