CatalogController::indexAction()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 2
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