Completed
Push — master ( 8ae3e6...6d116a )
by Aurimas
13:06
created

Controller   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 23
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A jsonView() 0 6 1
1
<?php
2
3
namespace Thruster\Bundle\ViewBundle\Controller;
4
5
use Symfony\Bundle\FrameworkBundle\Controller\Controller as BaseController;
6
use Symfony\Component\HttpFoundation\JsonResponse;
7
use Thruster\Bundle\ViewBundle\Traits\ViewAwareTrait;
8
9
class Controller extends BaseController
10
{
11
    use ViewAwareTrait;
12
13
    /**
14
     * @param string $view  A short notation view (a:b:c) "AppBundle:Default:homepage" or "homepage"
15
     *                      (for same name view class as controller under View folder with suffix View instead of
16
     *                      Controller for e.g. For AppBundle\Controller\DefaultController AppBundle\View\DefaultView
17
     * @param mixed  $data
18
     * @param int    $status
19
     * @param array  $headers
20
     * @param array  $context
21
     *
22
     * @return JsonResponse
23
     * @throws \InvalidArgumentException
24
     */
25
    protected function jsonView($view, $data, $status = 200, $headers = [], $context = [])
26
    {
27
        $data = $this->view($view, $data);
28
29
        return parent::json($data, $status, $headers, $context);
0 ignored issues
show
Comprehensibility Bug introduced by
It seems like you call parent on a different method (json() instead of jsonView()). Are you sure this is correct? If so, you might want to change this to $this->json().

This check looks for a call to a parent method whose name is different than the method from which it is called.

Consider the following code:

class Daddy
{
    protected function getFirstName()
    {
        return "Eidur";
    }

    protected function getSurName()
    {
        return "Gudjohnsen";
    }
}

class Son
{
    public function getFirstName()
    {
        return parent::getSurname();
    }
}

The getFirstName() method in the Son calls the wrong method in the parent class.

Loading history...
30
    }
31
}
32