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

IndexController::init()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
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