aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Schemas/ContentTermsOfUse.php
blob: b827788e1fcc79b567ba47114b7a0196f9d130ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace JsonApi\Schemas;

use Neomerx\JsonApi\Contracts\Schema\ContextInterface;

class ContentTermsOfUse extends SchemaProvider
{
    const TYPE = 'terms-of-use';

    public function getId($resource): ?string
    {
        return $resource->id;
    }

    public function getAttributes($resource, ContextInterface $context): iterable
    {
        return [
            'name' => (string) $resource['name'],
            'description' => mb_strlen($resource['description']) ? (string) $resource['description'] : null,
            'icon' => $resource['icon'],
            'download-condition' => (int) $resource['download_condition'],
            'mkdate' => date('c', $resource['mkdate']),
            'chdate' => date('c', $resource['chdate']),
        ];
    }

    public function getRelationships($user, ContextInterface $context): iterable
    {
        return [];
    }
}