CatalogController   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 0%
Metric Value
wmc 2
lcom 0
cbo 5
dl 0
loc 14
ccs 0
cts 10
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A indexAction() 0 5 1
A productRedirectAction() 0 5 1
1
<?php
2
3
namespace SpeckCatalog\Controller;
4
5
use Zend\Mvc\Controller\AbstractActionController;
6
use Zend\View\Model\ViewModel;
7
8
class CatalogController extends AbstractActionController
9
{
10
    public function indexAction()
11
    {
12
        $categories = $this->getServiceLocator()->get('speckcatalog_category_service')->getCategoriesForNavigation();
13
        return new ViewModel(array('categories' => $categories));
14
    }
15
16
    public function productRedirectAction()
17
    {
18
        $id = (int) $this->getEvent()->getRouteMatch()->getParam('id');
19
        return $this->redirect()->toRoute('product/byid', array('id' => $id));
20
    }
21
}
22