public function getAllReplies($commentId, $commentRepository)
{
if (!is_array($commentId)) {
$directReplies = $commentRepository->getDirectReplies($commentId);
if (count($directReplies)) {
return array_merge(array($commentId), $this->getAllReplies($directReplies, $commentRepository));
} else {
return array($commentId);
}
} else {
if (count($commentId) > 1) {
return array_merge($this->getAllReplies(array_pop($commentId), $commentRepository), $this->getAllReplies($commentId, $commentRepository));
} else {
return $this->getAllReplies(array_pop($commentId), $commentRepository);
}
}
}