Completed
Push — master ( 748a9b...e6e538 )
by Jonas
03:08
created

VersionAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

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 0
cts 8
cp 0
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 SteamScore\Api\Version;
20
use Zend\Diactoros\Response\JsonResponse;
21
use Zend\Stratigility\MiddlewareInterface;
22
23
final class VersionAction implements MiddlewareInterface
24
{
25
    /**
26
     * @var Version
27
     */
28
    private $version;
29
30
    /**
31
     * Constructor.
32
     *
33
     * @param Version $version
34
     */
35
    public function __construct(Version $version)
36
    {
37
        $this->version = $version;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function __invoke(Request $request, Response $response, callable $out = null)
44
    {
45
        return new JsonResponse(['version' => $version->getVersion()]);
0 ignored issues
show
Bug introduced by
The variable $version does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
46
    }
47
}
48