Completed
Push — master ( 5d31f9...7b1630 )
by Sander
21s queued 10s
created

Group::setRoles()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace Kunstmaan\AdminBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use FOS\UserBundle\Model\GroupInterface;
7
8
// NEXT_MAJOR: BC layer for deprecated RoleInterface on sf 3.4. Remove this if (keep the else) and move the content of the trait back into this class. Trait is final/internal by default so can be removed
9
if (interface_exists('\Symfony\Component\Security\Core\Role\RoleInterface')) {
10
    /**
11
     * Group
12
     *
13
     * @ORM\Entity
14
     * @ORM\Table(name="kuma_groups")
15
     */
16
    class Group implements \Symfony\Component\Security\Core\Role\RoleInterface, GroupInterface
0 ignored issues
show
Deprecated Code introduced by
The interface Symfony\Component\Security\Core\Role\RoleInterface has been deprecated with message: The RoleInterface is deprecated since version 3.3 and will be removed in 4.0. Extend the Symfony\Component\Security\Core\Role\Role class instead.

This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.

Loading history...
17
    {
18
        use GroupPropertiesTrait;
19
    }
20
} else {
21
    /**
22
     * Group
23
     *
24
     * @ORM\Entity
25
     * @ORM\Table(name="kuma_groups")
26
     */
27
    class Group implements GroupInterface
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
Comprehensibility Best Practice introduced by
The type Kunstmaan\AdminBundle\Entity\Group has been defined more than once; this definition is ignored, only the first definition in this file (L16-19) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
28
    {
29
        use GroupPropertiesTrait;
30
    }
31
}
32