public function redirectToOriginalEntity(Url $url, CommentInterface $comment = NULL, Entity $entity = NULL) {
    $options = [];
    if (isset($comment)) {
      $options = ['fragment' => 'comment-' . $comment->id()];
    }
    return $this->redirect($url->getRouteName(), $url->getRouteParameters(), $options);
  }
public function redirectToOriginalEntity(Url $url, CommentInterface $comment = NULL, Entity $entity = NULL) {
    $options = [];
    if (isset($comment)) {
      $options = ['fragment' => 'comment-' . $comment->id()];
    }
    return $this->redirect($url->getRouteName(), $url->getRouteParameters(), $options);
  }
public function redirectToOriginalEntity ( Url $ url , CommentInterface $ comment = NULL , Entity $ entity = NULL ) { $ options = [ ] ; if ( isset ( $ comment ) ) { $ options = [ 'fragment' => 'comment-' . $ comment -> id ( ) ] ; } return $ this -> redirect ( $ url -> getRouteName ( ) , $ url -> getRouteParameters ( ) , $ options ) ; }
Redirects to the original entity when conditions are met.

@param \Drupal\Core\Url $url
The canonical url.
@param \Drupal\comment\CommentInterface $comment
The comment interface.
@param \Drupal\Core\Entity\Entity $entity
The Entity to redirect to.

@return \Symfony\Component\HttpFoundation\RedirectResponse
Returns the Redirect Response.
Redirects to the original entity when conditions are met .