Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Modules\Comments\Application\Service; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Modules\Comments\Application\DTO\CommentStreamDto; |
| 12 | use App\Modules\Comments\Application\DTO\CreateCommentDto; |
| 13 | use App\Modules\Comments\Domain\Model\Comment; |
| 14 | use App\Modules\Comments\Domain\Model\CommentAttachment; |
| 15 | use App\Modules\Comments\Domain\Model\CommentFilterScope; |
| 16 | |
| 17 | /** |
| 18 | * Interface for CommentService. |
| 19 | * |
| 20 | * @package App\Modules\Comments\Application\Service |
| 21 | */ |
| 22 | interface CommentServiceInterface |
| 23 | { |
| 24 | /** |
| 25 | * Retrieves conversation stream with filter scope and aggregate tab counts. |
| 26 | */ |
| 27 | public function getStream( |
| 28 | string $module, |
| 29 | int $recordId, |
| 30 | CommentFilterScope $scope, |
| 31 | ?int $currentUserId, |
| 32 | int $limit = 100, |
| 33 | int $offset = 0 |
| 34 | ): CommentStreamDto; |
| 35 | |
| 36 | /** |
| 37 | * Posts a new comment or reply with automatic hierarchy rollup and attachments. |
| 38 | */ |
| 39 | public function createComment(CreateCommentDto $dto, int $authorUserId, string $authorName): Comment; |
| 40 | |
| 41 | /** |
| 42 | * Toggles comment pinned highlight state. |
| 43 | */ |
| 44 | public function togglePin(int $commentId): bool; |
| 45 | |
| 46 | /** |
| 47 | * Toggles comment verified state for client portal. |
| 48 | */ |
| 49 | public function toggleVerify(int $commentId): bool; |
| 50 | |
| 51 | /** |
| 52 | * Deletes a comment with authorization verification. |
| 53 | */ |
| 54 | public function deleteComment(int $commentId, ?int $currentUserId, bool $isSuperuser = false): bool; |
| 55 | |
| 56 | /** |
| 57 | * Finds single comment attachment by secure public token. |
| 58 | */ |
| 59 | public function findAttachmentByToken(string $token): ?CommentAttachment; |
| 60 | |
| 61 | /** |
| 62 | * Finds single comment by primary key ID. |
| 63 | */ |
| 64 | public function findCommentById(int $commentId): ?Comment; |
| 65 | |
| 66 | /** |
| 67 | * Transforms comment content to rich sanitized HTML. |
| 68 | */ |
| 69 | public function renderFormattedContent(string $rawContent): string; |
| 70 | } |