open-orchestra/open-orchestra-cms-bundle

View on GitHub
Backoffice/Manager/BlockManager.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid assigning values to variables in if clauses and the like (line '80', column '39').
Open

    protected function setDefaultAttributes(BlockInterface $block)
    {
        $defaultConfiguration = $this->generateFormManager->getDefaultConfiguration($block);
        foreach ($defaultConfiguration as $key => $value) {
            if (in_array($key, $this->fixedParameters) &&
Severity: Minor
Found in Backoffice/Manager/BlockManager.php by phpmd

IfStatementAssignment

Since: 2.7.0

Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

Example

class Foo
{
    public function bar($flag)
    {
        if ($foo = 'bar') { // possible typo
            // ...
        }
        if ($baz = 0) { // always false
            // ...
        }
    }
}

Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

Avoid using static access to class '\Doctrine\Common\Util\Inflector' in method 'setDefaultAttributes'.
Open

                method_exists($block, $setter = 'set' . Inflector::classify($key))
Severity: Minor
Found in Backoffice/Manager/BlockManager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Call to method getLabel from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

        $block->setLabel($block->getLabel()."[".$oldLanguage."]");
Severity: Critical
Found in Backoffice/Manager/BlockManager.php by phan

Parameter $block has undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

    protected function setDefaultAttributes(BlockInterface $block)
Severity: Minor
Found in Backoffice/Manager/BlockManager.php by phan

Call to method setLabel from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

        $block->setLabel($block->getLabel()."[".$oldLanguage."]");
Severity: Critical
Found in Backoffice/Manager/BlockManager.php by phan

Return type of createToTranslateBlock() is undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

    public function createToTranslateBlock(BlockInterface $block, $language)
Severity: Minor
Found in Backoffice/Manager/BlockManager.php by phan

Call to method setLanguage from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

        $block->setLanguage($language);
Severity: Critical
Found in Backoffice/Manager/BlockManager.php by phan

Return type of initializeBlock() is undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

    public function initializeBlock($component, $siteId, $language, $isTransverse)
Severity: Minor
Found in Backoffice/Manager/BlockManager.php by phan

Call to method classify from undeclared class \Doctrine\Common\Util\Inflector
Open

                method_exists($block, $setter = 'set' . Inflector::classify($key))
Severity: Critical
Found in Backoffice/Manager/BlockManager.php by phan

Call to method setAttributes from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

        $block->setAttributes($defaultConfiguration);
Severity: Critical
Found in Backoffice/Manager/BlockManager.php by phan

Parameter $block has undeclared type \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

    public function createToTranslateBlock(BlockInterface $block, $language)
Severity: Minor
Found in Backoffice/Manager/BlockManager.php by phan

Call to method getLanguage from undeclared class \OpenOrchestra\ModelInterface\Model\BlockInterface
Open

        $oldLanguage = $block->getLanguage();
Severity: Critical
Found in Backoffice/Manager/BlockManager.php by phan

There must be a single space between the closing parenthesis and the opening brace of a multi-line function declaration; found 0 spaces
Open

    ){

There are no issues that match your filters.

Category
Status