HubicController::injectHubicService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Filoucrackeur\Hubic\Controller;
4
5
use Filoucrackeur\Hubic\Domain\Model\Account;
6
use Filoucrackeur\Hubic\Domain\Repository\AccountRepository;
7
use Filoucrackeur\Hubic\Service\HubicService;
8
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
9
10
class HubicController extends ActionController
11
{
12
    /**
13
     * @var \Filoucrackeur\Hubic\Service\HubicService
14
     */
15
    protected $hubicService;
16
17
    /**
18
     * @var \Filoucrackeur\Hubic\Domain\Repository\AccountRepository
19
     */
20
    protected $accountRepository;
21
22
    public function listAction()
23
    {
24
        /** @var Account $account */
25
        $account = $this->accountRepository->findByIdentifier($this->settings['account']);
26
        if ($account) {
27
            $this->hubicService->setAccount($account);
28
            $this->view->assign('links', $this->hubicService->getAllLinks());
29
        }
30
    }
31
32
    /**
33
     * @param AccountRepository $accountRepository
34
     */
35
    public function injectAccountRepository(AccountRepository $accountRepository)
36
    {
37
        $this->accountRepository = $accountRepository;
38
    }
39
40
    /**
41
     * @param HubicService $hubicService
42
     */
43
    public function injectHubicService(HubicService $hubicService)
44
    {
45
        $this->hubicService = $hubicService;
46
    }
47
}
48