open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Tests/Security/Authorization/Voter/NodeVoterTest.php

Summary

Maintainability
F
1 wk
Test Coverage

Method getNotSupportedSubjects has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getNotSupportedSubjects()
    {
        $content = $this->createPhakeContent();
        $trashItem = $this->createPhakeTrashItem();
        $site = $this->createPhakeSite();
Severity: Minor
Found in Backoffice/Tests/Security/Authorization/Voter/NodeVoterTest.php - About 1 hr to fix

The class NodeVoterTest has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
Open

class NodeVoterTest extends AbstractVoterTest
{
    /**
     * Set up the test
     */

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

Source https://phpmd.org/rules/design.html#couplingbetweenobjects

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\KeywordInterface
Open

            'Bad subject : Entity type Keyword'     => array(KeywordInterface::ENTITY_TYPE,         ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad action : Trash Purge'   => array($node, ContributionActionInterface::TRASH_PURGE,   array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Api client'  => array(ApiClientInterface::ENTITY_TYPE,       ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Content'                 => array($content,                              ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Status'                  => array($status,                               ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type User'        => array(UserInterface::ENTITY_TYPE,            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Group'       => array(GroupInterface::ENTITY_TYPE,           ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : Content super editor'      => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_GRANTED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Ok : Edit other'   => array($node,     ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_GRANTED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Trash Item'              => array($trashItem,                            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : Content contributor'       => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_GRANTED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Ok : Delete other' => array($node,     ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_GRANTED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Keyword'                 => array($keyword,                              ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : Trash Restorer'            => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_RESTORER),          true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_GRANTED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Ok : Edit self'    => array($nodeSelf, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Site'                    => array($site,                                 ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\BaseApi\Model\ApiClientInterface
Open

            'Bad subject : Entity type Api client'  => array(ApiClientInterface::ENTITY_TYPE,       ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Site Admin'              => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::SITE_ADMIN),              true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Trash Restorer'          => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::TRASH_RESTORER),          true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_GRANTED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Ok : Add self'     => array($nodeSelf, ContributionActionInterface::CREATE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Group'                   => array($group,                                ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Content type'            => array($contentType,                          ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Site'        => array(SiteInterface::ENTITY_TYPE,            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\RedirectionInterface
Open

            'Bad subject : Entity type Redirection' => array(RedirectionInterface::ENTITY_TYPE,     ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Log'         => array(LogInterface::ENTITY_TYPE,             ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_GRANTED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Ok : Read'         => array($node,     ContributionActionInterface::READ,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\WorkflowProfileInterface
Open

            'Bad subject : Entity type Workflow'    => array(WorkflowProfileInterface::ENTITY_TYPE, ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Status'      => array(StatusInterface::ENTITY_TYPE,          ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Redirection' => array(RedirectionInterface::ENTITY_TYPE,     ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad action : Trash Restore' => array($node, ContributionActionInterface::TRASH_RESTORE, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Not in perimeter : Read self'    => array($nodeSelf, ContributionActionInterface::READ,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     false, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Not in perimeter : Delete self'  => array($nodeSelf, ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     false, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Content super supressor' => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Log'                     => array($log,                                  ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type ContentType' => array(ContentTypeInterface::ENTITY_TYPE,     ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\StatusInterface
Open

            'Bad subject : Entity type Status'      => array(StatusInterface::ENTITY_TYPE,          ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\UserBundle\Model\UserInterface
Open

            'Bad subject : Entity type User'        => array(UserInterface::ENTITY_TYPE,            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : Content super supressor'   => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Content contributor'     => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_GRANTED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Ok : Delete self'  => array($nodeSelf, ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Redirection'             => array($redirection,                          ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Workflow profile'        => array($profile,                              ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Not in perimeter : Edit self'    => array($nodeSelf, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     false, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Trash Supressor'         => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::TRASH_SUPRESSOR),         true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Workflow'    => array(WorkflowProfileInterface::ENTITY_TYPE, ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Not in perimeter : Delete other' => array($node,     ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), false, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : Trash Supressor'           => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_SUPRESSOR),         true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Entity type Keyword'     => array(KeywordInterface::ENTITY_TYPE,         ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Content super editor'    => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : Api client'              => array($client,                               ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\ContentTypeInterface
Open

            'Bad subject : Entity type ContentType' => array(ContentTypeInterface::ENTITY_TYPE,     ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Not in perimeter : Edit other'   => array($node,     ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    false, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : Site Admin'                => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::SITE_ADMIN),              true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad subject : User'                    => array($user,                                 ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ENTITY_TYPE from undeclared class \OpenOrchestra\ModelInterface\Model\SiteInterface
Open

            'Bad subject : Entity type Site'        => array(SiteInterface::ENTITY_TYPE,            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : None'                      => array($node, ContributionActionInterface::EDIT,   array(),                                                   true, VoterInterface::ACCESS_DENIED),

Reference to constant ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : None'                    => array($node, ContributionActionInterface::DELETE, array(),                                                   true, VoterInterface::ACCESS_DENIED),

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function getNotSupportedSubjects()
    {
        $content = $this->createPhakeContent();
        $trashItem = $this->createPhakeTrashItem();
        $site = $this->createPhakeSite();
Backoffice/Tests/Security/Authorization/Voter/TrashItemVoterTest.php on lines 39..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 972.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function getBadRoles()
    {
        $node = $this->createPhakeNode();

        return array(
Backoffice/Tests/Security/Authorization/Voter/NodeNotHydratedVoterTest.php on lines 114..134

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 524.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function getOkVotes()
    {
        $node = $this->createPhakeNode();
        $nodeSelf = $this->createPhakeNode(true);

Backoffice/Tests/Security/Authorization/Voter/NodeNotHydratedVoterTest.php on lines 139..152

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 256.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function getNotInPerimeter()
    {
        $node = $this->createPhakeNode();
        $nodeSelf = $this->createPhakeNode(true);

Backoffice/Tests/Security/Authorization/Voter/NodeNotHydratedVoterTest.php on lines 97..109

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 219.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 6 locations. Consider refactoring.
Open

    protected function getNotSupportedAttributes()
    {
        $node = $this->createPhakeNode();

        return array(
Backoffice/Tests/Security/Authorization/Voter/ContentVoterTest.php on lines 77..85
Backoffice/Tests/Security/Authorization/Voter/DeveloperToolVoterTest.php on lines 75..83
Backoffice/Tests/Security/Authorization/Voter/NodeNotHydratedVoterTest.php on lines 84..92
Backoffice/Tests/Security/Authorization/Voter/PlatformAdministrationVoterTest.php on lines 78..86
Backoffice/Tests/Security/Authorization/Voter/SiteAdministrationVoterTest.php on lines 69..77

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Workflow profile'        => array($profile,                              ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 197 characters
Open

            'Not in perimeter : Read self'    => array($nodeSelf, ContributionActionInterface::READ,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     false, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 197 characters
Open

            'Not in perimeter : Edit self'    => array($nodeSelf, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     false, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 183 characters
Open

            'Ok : Edit self'    => array($nodeSelf, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Log'         => array(LogInterface::ENTITY_TYPE,             ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Edit) : Content super supressor'   => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 183 characters
Open

            'Ok : Read'         => array($node,     ContributionActionInterface::READ,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Line exceeds 120 characters; contains 183 characters
Open

            'Ok : Delete self'  => array($nodeSelf, ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Api client'              => array($client,                               ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Content type'            => array($contentType,                          ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Edit) : None'                      => array($node, ContributionActionInterface::EDIT,   array(),                                                   true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Site'                    => array($site,                                 ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : User'                    => array($user,                                 ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Group'                   => array($group,                                ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Status'      => array(StatusInterface::ENTITY_TYPE,          ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Keyword'     => array(KeywordInterface::ENTITY_TYPE,         ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Edit) : Content super editor'      => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Delete) : Site Admin'              => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::SITE_ADMIN),              true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Delete) : Trash Restorer'          => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::TRASH_RESTORER),          true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Log'                     => array($log,                                  ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 184 characters
Open

            'Bad action : Trash Restore' => array($node, ContributionActionInterface::TRASH_RESTORE, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Api client'  => array(ApiClientInterface::ENTITY_TYPE,       ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Delete) : None'                    => array($node, ContributionActionInterface::DELETE, array(),                                                   true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Trash Item'              => array($trashItem,                            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type ContentType' => array(ContentTypeInterface::ENTITY_TYPE,     ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Workflow'    => array(WorkflowProfileInterface::ENTITY_TYPE, ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Edit) : Site Admin'                => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::SITE_ADMIN),              true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Edit) : Trash Restorer'            => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_RESTORER),          true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 183 characters
Open

            'Ok : Add self'     => array($nodeSelf, ContributionActionInterface::CREATE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Content'                 => array($content,                              ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Status'                  => array($status,                               ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Site'        => array(SiteInterface::ENTITY_TYPE,            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Group'       => array(GroupInterface::ENTITY_TYPE,           ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Edit) : Trash Supressor'           => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_SUPRESSOR),         true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Keyword'                 => array($keyword,                              ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Redirection'             => array($redirection,                          ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Delete) : Trash Supressor'         => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::TRASH_SUPRESSOR),         true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type Redirection' => array(RedirectionInterface::ENTITY_TYPE,     ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 184 characters
Open

            'Bad action : Trash Purge'   => array($node, ContributionActionInterface::TRASH_PURGE,   array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Edit) : Content contributor'       => array($node, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Delete) : Content super supressor' => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 183 characters
Open

            'Ok : Delete other' => array($node,     ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_GRANTED),

Line exceeds 120 characters; contains 218 characters
Open

            'Bad subject : Entity type User'        => array(UserInterface::ENTITY_TYPE,            ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 197 characters
Open

            'Not in perimeter : Delete self'  => array($nodeSelf, ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     false, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Delete) : Content super editor'    => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 183 characters
Open

            'Ok : Edit other'   => array($node,     ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_GRANTED),

Line exceeds 120 characters; contains 197 characters
Open

            'Not in perimeter : Edit other'   => array($node,     ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    false, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 197 characters
Open

            'Not in perimeter : Delete other' => array($node,     ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), false, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 207 characters
Open

            'Bad role (Delete) : Content contributor'     => array($node, ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

There are no issues that match your filters.

Category
Status