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

HubicController   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 92.31%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 42
ccs 12
cts 13
cp 0.9231
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A listAction() 0 13 3
A injectAccountRepository() 0 4 1
A injectHubicService() 0 4 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