. */ declare(strict_types=1); namespace FireflyIII\Transformers; use FireflyIII\Models\Note; use League\CommonMark\CommonMarkConverter; use League\Fractal\TransformerAbstract; /** * Class NoteTransformer */ class NoteTransformer extends TransformerAbstract { /** * @param Note $note * * @return array */ public function transform(Note $note): array { $converter = new CommonMarkConverter; return [ 'id' => (int)$note->id, 'notable_type' => $note->noteable_type, 'title' => $note->title, 'text' => $note->text, 'markdown' => $converter->convertToHtml($note->text), 'links' => [ [ 'rel' => 'self', 'uri' => '/note/' . $note->id, ], ], ]; } }