aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Schemas/SlimRoute.php
blob: cc055942cdf250af92834435337862f28c1bf64e (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
33
34
35
36
37
<?php

namespace JsonApi\Schemas;

use Neomerx\JsonApi\Contracts\Schema\ContextInterface;

class SlimRoute extends SchemaProvider
{
    const TYPE = 'slim-routes';

    public function getId($route): ?string
    {
        return $route->getIdentifier();
    }

    public function getAttributes($route, ContextInterface $context): iterable
    {
        return [
            'methods' => $route->getMethods(),
            'name' => $route->getName(),
            'pattern' => $route->getPattern(),
        ];
    }

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

    /**
     * @inheritdoc
     */
    public function getLinks($resource): iterable
    {
        return [];
    }
}