Routes   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 37
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 32 1
1
<?php
2
3
/**
4
 * Routes
5
 * @copyright Copyright (c) 2011 - 2014 Aleksandr Torosh (http://wezoom.com.ua)
6
 * @author Aleksandr Torosh <[email protected]>
7
 */
8
9
namespace Publication;
10
11
use Publication\Model\Publication;
12
use Publication\Model\Type;
13
14
class Routes
15
{
16
17
    public function init($router)
18
    {
19
        $types_keys = array_keys(Type::types());
20
        $types_regex = '(' . implode('|', $types_keys) . ')';
21
22
        $router->add('/publication/admin/{type:' . $types_regex . '}', array(
23
            'module' => 'publication',
24
            'controller' => 'admin',
25
            'action' => 'index'
26
        ))->setName('publications_admin');
27
28
        $router->add('/publication/admin/{type:' . $types_regex . '}/([a-zA-Z0-9_]+)', array(
29
            'module' => 'publication',
30
            'controller' => 'admin',
31
            'action' => 2
32
        ))->setName('publications_admin_action');
33
34
        $router->addML('/{type:' . $types_regex . '}', array(
35
            'module' => 'publication',
36
            'controller' => 'index',
37
            'action' => 'index'
38
        ), 'publications');
39
40
        $router->addML('/{type:' . $types_regex . '}/{slug:[a-zA-Z0-9_-]+}.html', array(
41
            'module' => 'publication',
42
            'controller' => 'index',
43
            'action' => 'publication'
44
        ), 'publication');
45
46
        return $router;
47
48
    }
49
50
}