Test Failed
Push — feature-laravel-5.4 ( 556e60...89a18e )
by Kirill
03:48
created

DocsSerializer::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 10
nc 1
nop 1
dl 13
loc 13
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 App\Models\Docs;
12
use Illuminate\Database\Eloquent\Model;
13
14
/**
15
 * Class DocsSerializer
16
 * @package App\GraphQL\Serializers
17
 */
18 View Code Duplication
class DocsSerializer extends AbstractSerializer
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    /**
21
     * @param Model|Docs $docs
22
     * @return array
23
     */
24
    public function toArray(Model $docs): array
25
    {
26
        return [
27
            'id'          => $docs->id,
28
            'title'       => $docs->title,
29
            'image'       => $docs->image,
30
            'version'     => $docs->version,
31
            'description' => $docs->description,
32
            'created_at'  => $this->formatDateTime($docs->created_at),
33
            'updated_at'  => $this->formatDateTime($docs->updated_at),
34
            'pages'       => DocsPageSerializer::collection($docs->pages)
35
        ];
36
    }
37
}