Completed
Pull Request — development (#3)
by Philippe
04:45 queued 02:15
created

HubicController::injectAccountRepository()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
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 1
    public function listAction()
23
    {
24
        try {
25
26
            /** @var Account $account */
27 1
            $account = $this->accountRepository->findByIdentifier($this->settings['account']);
28 1
            if ($account) {
29 1
                $this->hubicService->setAccount($account);
30 1
                $this->view->assign('links', $this->hubicService->getAllLinks());
31
            }
32
        } catch(\Exception $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
33
        }
34 1
    }
35
36
    /**
37
     * @param AccountRepository $accountRepository
38
     */
39 1
    public function injectAccountRepository(AccountRepository $accountRepository)
40
    {
41 1
        $this->accountRepository = $accountRepository;
42 1
    }
43
44
    /**
45
     * @param HubicService $hubicService
46
     */
47 1
    public function injectHubicService(HubicService $hubicService)
48
    {
49 1
        $this->hubicService = $hubicService;
50 1
    }
51
}
52