Completed
Push — dev-master ( afc675...fc0d7a )
by Derek Stephen
55:35 queued 54:42
created

IndexController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 2
A indexAction() 0 4 1
A learnAction() 0 4 1
A jsonAction() 0 9 1
1
<?php
2
3
namespace App\Controller;
4
5
use AspectMock\Test;
6
use Bone\Mvc\Controller;
7
use Bone\Mvc\Dispatcher;
8
use Bone\Mvc\Registry;
9
use Bone\Mvc\View\PlatesEngine;
10
use Zend\Diactoros\Response;
11
use Zend\Diactoros\Response\TextResponse;
12
13
14
class IndexController extends Controller
15
{
16 1
    public function init()
17
    {
18 1
        $locale = $this->getParam('locale') ?: Registry::ahoy()->get('i18n')['default_locale'];
19 1
        $this->getTranslator()->setLocale($locale);
0 ignored issues
show
Bug introduced by
The method getTranslator() does not seem to exist on object<App\Controller\IndexController>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
20 1
    }
21
22 2
    public function indexAction()
23
    {
24
25 2
    }
26
27 1
    public function learnAction()
28
    {
29
30 1
    }
31
32 1
    public function jsonAction()
33
    {
34
        // example of a Json page
35
        $array = array(
36 1
          'Rum' => 'tasty',
37
          'Grog' => 'the best!',
38
        );
39 1
        $this->sendJsonResponse($array);
40 1
    }
41
}
42