SearchResultsSerializer::toArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * This file is part of laravel.su package.
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
declare(strict_types=1);
8
9
namespace App\GraphQL\Serializers;
10
11
use Service\SearchService\SearchResult;
12
13
/**
14
 * Class SearchResultsSerializer.
15
 */
16
class SearchResultsSerializer extends AbstractSerializer
17
{
18
    /**
19
     * @param SearchResult $dto
20
     * @return array
21
     */
22
    public function toArray($dto): array
23
    {
24
        return [
25
            'slug'    => $dto->slug,
26
            'url'     => $dto->url,
27
            'content' => $dto->body,
28
            'title'   => $dto->title,
29
            'type'    => $dto->type,
30
        ];
31
    }
32
}
33