aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Schemas/ContentTermsOfUse.php
blob: 6991a220e45c0333ad2f4fe3cabf827efdf20471 (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
<?php

namespace JsonApi\Schemas;

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

    protected $resourceType = self::TYPE;

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

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