aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/JsonApi/Routes/SemestersShow.php
blob: c13a5456ef1d2b44bdeb25b48ca251825359c0a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?php

namespace JsonApi\Routes;

use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;
use JsonApi\Errors\RecordNotFoundException;
use JsonApi\JsonApiController;

/**
 * Displays a single semester.
 */
class SemestersShow extends JsonApiController
{
    public function __invoke(Request $request, Response $response, $args)
    {
        if (!$semester = \Semester::find($args['id'])) {
            throw new RecordNotFoundException();
        }

        return $this->getContentResponse($semester);
    }
}