aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Schemas/LtiTool.php
blob: 58aa24cd1649fa1d1ac6d5ce3624015e4c317681 (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
<?php

namespace JsonApi\Schemas;

use Neomerx\JsonApi\Contracts\Schema\ContextInterface;

class LtiTool extends SchemaProvider
{
    const TYPE = 'lti-tools';

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

    public function getAttributes($resource, ContextInterface $context): iterable
    {
        return [
            'name' => $resource->name,
            'launch-url' => $resource->launch_url,
            'allow-custom-url' => (bool) $resource->allow_custom_url,
            'deep-linking' => (bool) $resource->deep_linking,
        ];
    }

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