Completed
Pull Request — master (#9)
by Iakov
03:57
created

KamiApiCoreDescriber::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Kami\ApiCoreBundle\Bridge\NelmioApiDoc\RouteDescriber;
4
5
6
use EXSyst\Component\Swagger\Swagger;
7
use Kami\ApiCoreBundle\Controller\ApiController;
8
use Kami\ApiCoreBundle\Stenographer\Stenographer;
9
use Nelmio\ApiDocBundle\RouteDescriber\RouteDescriberInterface;
10
use Symfony\Component\Routing\Route;
11
12
13
class KamiApiCoreDescriber implements RouteDescriberInterface
14
{
15
16
    private $stenographer;
17
18
    public function __construct(Stenographer $stenographer)
19
    {
20
        $this->stenographer = $stenographer;
21
    }
22
23
    public function describe(Swagger $api, Route $route, \ReflectionMethod $reflectionMethod)
24
    {
25
        if (ApiController::class === $reflectionMethod->getDeclaringClass()) {
26
            return $this->stenographer->getStenography();
0 ignored issues
show
Bug introduced by
Are you sure the usage of $this->stenographer->getStenography() targeting Kami\ApiCoreBundle\Steno...apher::getStenography() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
27
        }
28
    }
29
30
}