ArticleTransformer::transform()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 8
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
4
namespace App\Project\Domain\Article;
5
6
7
use App\Project\Domain\Article\Entity\Article;
8
use League\Fractal\TransformerAbstract;
9
10
class ArticleTransformer extends TransformerAbstract
11
{
12
    /**
13
     * @param Article $article
14
     * @return array
15
     */
16
    public function transform(Article $article)
17
    {
18
        return [
19
            'id' => $article->getId(),
20
            'title' => $article->getTitle(),
21
            'body' => $article->getBody(),
22
            'tags' => $article->getTags(),
23
            'createdAt' => date('Y-m-d')
24
        ];
25
    }
26
27
}