Code Duplication    Length = 21-21 lines in 2 locations

app/src/Schema/MediaFileSchema.php 1 location

@@ 99-119 (lines=21) @@
96
 * @apiUse NotFoundError
97
 */
98
99
final class MediaFileSchema extends BaseSchema
100
{
101
    protected $resourceType = 'media-file';
102
103
    public function getId($entity)
104
    {
105
        return $entity->id;
106
    }
107
108
    public function getAttributes($entity)
109
    {
110
        return [
111
            'file'       => (string)$entity->file,
112
            'file_info'  => json_decode($entity->file_info),
113
            'created_by' => (integer)$entity->created_by,
114
            'updated_by' => (integer)$entity->updated_by,
115
            'created_at' => Carbon::parse($entity->created_at)->setTimezone('UTC')->format(Carbon::ISO8601),
116
            'updated_at' => Carbon::parse($entity->updated_at)->setTimezone('UTC')->format(Carbon::ISO8601),
117
        ];
118
    }
119
}
120

app/src/Schema/RightSchema.php 1 location

@@ 199-219 (lines=21) @@
196
 * @apiUse NotFoundError
197
 */
198
199
final class RightSchema extends BaseSchema
200
{
201
    protected $resourceType = 'right';
202
203
    public function getId($right)
204
    {
205
        return $right->id;
206
    }
207
208
    public function getAttributes($right)
209
    {
210
        return [
211
            'name'        => $right->name,
212
            'description' => $right->description,
213
            'created_at'  => Carbon::parse($right->created_at)->setTimezone('UTC')->format(Carbon::ISO8601),
214
            'updated_at'  => Carbon::parse($right->updated_at)->setTimezone('UTC')->format(Carbon::ISO8601),
215
            'created_by'  => $right->created_by,
216
            'updated_by'  => $right->updated_by,
217
        ];
218
    }
219
}
220