Completed
Push — 1.x ( e997bd )
by Sullivan
19:38
created

PathInfoBuilderSlashes   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 20 3
1
<?php
2
3
/*
4
 * This file is part of the Sonata package.
5
 *
6
 * (c) Thomas Rabaix <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 */
12
13
namespace Sonata\DoctrinePHPCRAdminBundle\Route;
14
15
use Sonata\AdminBundle\Builder\RouteBuilderInterface;
16
use Sonata\AdminBundle\Admin\AdminInterface;
17
use Sonata\AdminBundle\Route\RouteCollection;
18
19
class PathInfoBuilderSlashes implements RouteBuilderInterface
20
{
21
    /**
22
     * RouteBuilder that allows slashes in the ids.
23
     *
24
     * {@inheritDoc}
25
     */
26
    function build(AdminInterface $admin, RouteCollection $collection)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
    {
28
29
        $collection->add('list');
30
        $collection->add('create');
31
        $collection->add('batch', null, array(), array('_method' => 'POST'));
32
        $collection->add('edit', $admin->getRouterIdParameter().'/edit', array(), array('id' => '.+'));
33
        $collection->add('delete', $admin->getRouterIdParameter().'/delete', array(), array('id' => '.+'));
34
        $collection->add('export');
35
        $collection->add('show', $admin->getRouterIdParameter().'/show', array(), array('id' => '.+', '_method' => 'GET'));
36
37
        if ($admin->isAclEnabled()) {
38
            $collection->add('acl', $admin->getRouterIdParameter().'/acl', array(), array('id' => '.+'));
39
        }
40
41
        // add children urls
42
        foreach ($admin->getChildren() as $children) {
43
            $collection->addCollection($children->getRoutes());
44
        }
45
    }
46
}
47