Completed
Push — master ( 8172e1...b4e742 )
by Jonas
01:48
created

VersionAction::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 3
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of SteamScore.
7
 *
8
 * (c) SteamScore <[email protected]>
9
 *
10
 * This Source Code Form is subject to the terms of the Mozilla Public
11
 * License, v. 2.0. If a copy of the MPL was not distributed with this
12
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
13
 */
14
15
namespace SteamScore\Api\Http\Actions;
16
17
use Psr\Http\Message\ResponseInterface as Response;
18
use Psr\Http\Message\ServerRequestInterface as Request;
19
use Zend\Diactoros\Response\JsonResponse;
20
use Zend\Stratigility\MiddlewareInterface;
21
22
final class VersionAction implements MiddlewareInterface
23
{
24
    /**
25
     * @var string
26
     */
27
    private $version;
28
29
    /**
30
     * Constructor.
31
     *
32
     * @param string $version
33
     */
34 2
    public function __construct(string $version)
35
    {
36 2
        $this->version = $version;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function __invoke(Request $request, Response $response, callable $out = null)
43
    {
44
        return new JsonResponse(['version' => $this->version]);
45
    }
46
}
47