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

VersionAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 50%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 25
ccs 2
cts 4
cp 0.5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __invoke() 0 4 1
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