open-orchestra/open-orchestra-cms-bundle

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

Summary

Maintainability
A
1 hr
Test Coverage

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

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

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

class ContentVoterTest 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 ACCESS_GRANTED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

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

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

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

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

            'Bad role (Edit) : entity type node contributor'      => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type Trash Suppressor'      => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_SUPRESSOR),      true, VoterInterface::ACCESS_DENIED),

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

            'Ok : create entity type' => array($contentSelf,                  ContributionActionInterface::CREATE, array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

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_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Edit) : entity type nobe'                  => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(),                                                true, VoterInterface::ACCESS_DENIED),

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

            'Ok : Read entity type'   => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::READ,   array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

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 ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

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

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

            'Bad role (Delete) : Site Admin'                      => array($content,                      ContributionActionInterface::DELETE, 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 : Group'                   => array($group,                                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 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_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Trash Restorer'                  => array($content,                      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 : Read'               => array($content,                      ContributionActionInterface::READ,   array(),                                                   true, VoterInterface::ACCESS_GRANTED),

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

            'Bad subject : Node'                    => array($node,                                 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 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) : None'                              => array($content,                      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 (Edit) : Node contributor'                  => array($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

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 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_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Not in perimeter : create other' => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::CREATE, array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), false, 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 (Edit) : entity type node super editor'     => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type node super suppressor' => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), 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 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_ABSTAIN from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad action : Trash Purge'   => array($content, ContributionActionInterface::TRASH_PURGE,   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 : Delete other' => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), false, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Delete) : Node super suppressor'           => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_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) : Trash Suppressor'                => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::TRASH_SUPRESSOR),      true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type node contributor'      => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type Trash Suppressor'      => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_SUPRESSOR),      true, VoterInterface::ACCESS_DENIED),

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

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

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

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

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 ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

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

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

            'Bad role (Edit) : entity type node super editor'     => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

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

            'Ok : Read entity type'   => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::READ,   array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

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_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

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

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

            'Not in perimeter : Edit other'   => array($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_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($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::SITE_ADMIN),           true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type Site Admin'            => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::SITE_ADMIN),           true, VoterInterface::ACCESS_DENIED),

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

            'Ok : Delete other'       => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), 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_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 : Keyword'                 => array($keyword,                              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) : Node contributor'                => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : Node super editor'                 => array($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

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

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

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

            'Bad role (Edit) : entity type Trash Restore'         => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_RESTORER),       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 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 ACCESS_DENIED from undeclared class \Symfony\Component\Security\Core\Authorization\Voter\VoterInterface
Open

            'Bad role (Delete) : Node super editor'               => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type node super suppressor' => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type nobe'                  => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(),                                                true, VoterInterface::ACCESS_DENIED),

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 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 action : Trash Restore' => array($content, ContributionActionInterface::TRASH_RESTORE, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

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

            'Not in perimeter : read other'   => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::READ,   array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), false, VoterInterface::ACCESS_DENIED),

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

            'Not in perimeter : create other' => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::CREATE, array(ContributionRoleInterface::CONTENT_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) : entity type Trash Restore'         => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_RESTORER),       true, VoterInterface::ACCESS_DENIED),

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 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 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

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

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

            'Not in perimeter : read other'   => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::READ,   array(ContributionRoleInterface::CONTENT_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) : Node super suppressor'             => array($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

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

            'Bad role (Edit) : entity type Site Admin'            => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::SITE_ADMIN),           true, VoterInterface::ACCESS_DENIED),

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

    protected function getNotSupportedAttributes()
    {
        $content = $this->createPhakeContent();

        return array(
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/NodeVoterTest.php on lines 82..90
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 236 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

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

Line exceeds 120 characters; contains 212 characters
Open

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

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 220 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : entity type Site Admin'            => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::SITE_ADMIN),           true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : entity type nobe'                  => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(),                                                true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 218 characters
Open

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

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 220 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : entity type Trash Restore'         => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_RESTORER),       true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : entity type Trash Suppressor'      => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::TRASH_SUPRESSOR),      true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 212 characters
Open

            'Ok : Read entity type'   => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::READ,   array(ContributionRoleInterface::CONTENT_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 187 characters
Open

            'Bad action : Trash Purge'   => array($content, ContributionActionInterface::TRASH_PURGE,   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 236 characters
Open

            'Bad role (Edit) : entity type node super editor'     => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 212 characters
Open

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

Line exceeds 120 characters; contains 212 characters
Open

            'Ok : create entity type' => array($contentSelf,                  ContributionActionInterface::CREATE, array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     true, VoterInterface::ACCESS_GRANTED),

Line exceeds 120 characters; contains 220 characters
Open

            'Not in perimeter : Delete other' => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), false, 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 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 212 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : Node contributor'                  => array($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 212 characters
Open

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

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 187 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Delete) : Node contributor'                => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_CONTRIBUTOR),     true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : entity type node contributor'      => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_CONTRIBUTOR),     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 : Site'                    => array($site,                                 ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), true, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : Node super editor'                 => array($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Delete) : Node super editor'               => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_SUPER_EDITOR),    true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Delete) : Node super suppressor'           => array($content,                      ContributionActionInterface::DELETE, array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

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 Redirection' => array(RedirectionInterface::ENTITY_TYPE,     ContributionActionInterface::READ, array(ContributionRoleInterface::DEVELOPER), null, VoterInterface::ACCESS_ABSTAIN),

Line exceeds 120 characters; contains 220 characters
Open

            'Not in perimeter : read other'   => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::READ,   array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), false, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 220 characters
Open

            'Not in perimeter : create other' => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::CREATE, array(ContributionRoleInterface::CONTENT_SUPER_SUPRESSOR), false, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 236 characters
Open

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

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 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 236 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

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

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 212 characters
Open

            'Ok : Edit self'          => array($contentSelf,                  ContributionActionInterface::EDIT,   array(ContributionRoleInterface::CONTENT_CONTRIBUTOR),     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 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 220 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : Node super suppressor'             => array($content,                      ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

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 236 characters
Open

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

Line exceeds 120 characters; contains 236 characters
Open

            'Bad role (Edit) : entity type node super suppressor' => array(ContentInterface::ENTITY_TYPE, ContributionActionInterface::EDIT,   array(ContributionRoleInterface::NODE_SUPER_SUPRESSOR), true, VoterInterface::ACCESS_DENIED),

Line exceeds 120 characters; contains 212 characters
Open

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

There are no issues that match your filters.

Category
Status