open-orchestra/open-orchestra-cms-bundle

View on GitHub
ApiBundle/Transformer/FieldTypeTransformer.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$params'.
Open

    public function transform($fieldType, array $params = array())

UnusedFormalParameter

Since: 0.2

Avoid passing parameters to methods or constructors and then not using those parameters.

Example

class Foo
{
    private function bar($howdy)
    {
        // $howdy is not used
    }
}

Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

Reference to undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractTransformer
Open

        parent::__construct($facadeClass);

Parameter $fieldType has undeclared type \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

    public function transform($fieldType, array $params = array())

Call to method getFieldId from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        $facade->fieldId = $fieldType->getFieldId();

Call to method isSearchable from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        $facade->searchable = $fieldType->isSearchable();

Call to method getOptions from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        foreach ($fieldType->getOptions() as $option) {

Call to method getDefaultValue from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        $facade->defaultValue = $fieldType->getDefaultValue();

Call to method getLabels from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        $facade->label = $this->multiLanguagesChoiceManagerInterface->choose($fieldType->getLabels());

Call to method __construct from undeclared class \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open

            throw new TransformerParameterTypeException();

Parameter $multiLanguagesChoiceManagerInterface has undeclared type \OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface
Open

    public function __construct(

Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\FieldTypeTransformer->fieldsParameters (Did you mean $fieldsParameters)
Open

        $this->fieldsParameters = $fieldsParameters;

@throws type of transform has undeclared type \OpenOrchestra\BaseApi\Exceptions\TransformerParameterTypeException
Open

    public function transform($fieldType, array $params = array())

Call to undeclared method \OpenOrchestra\ApiBundle\Transformer\FieldTypeTransformer::newFacade
Open

        $facade = $this->newFacade();

Call to method choose from undeclared class \OpenOrchestra\ModelInterface\Manager\MultiLanguagesChoiceManagerInterface
Open

        $facade->label = $this->multiLanguagesChoiceManagerInterface->choose($fieldType->getLabels());

Checking instanceof against undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        if (!$fieldType instanceof FieldTypeInterface) {

Reference to undeclared property \OpenOrchestra\ApiBundle\Transformer\FieldTypeTransformer->fieldsParameters
Open

        $facade->search = array_key_exists($fieldType->getType(), $this->fieldsParameters) && isset($this->fieldsParameters[$fieldType->getType()]['search']) ? $this->fieldsParameters[$fieldType->getType()]['search'] : '';

Call to method getListable from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        $facade->listable = $fieldType->getListable();

Call to method getType from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        $facade->search = array_key_exists($fieldType->getType(), $this->fieldsParameters) && isset($this->fieldsParameters[$fieldType->getType()]['search']) ? $this->fieldsParameters[$fieldType->getType()]['search'] : '';

Call to method getType from undeclared class \OpenOrchestra\ModelInterface\Model\FieldTypeInterface
Open

        $facade->type = $fieldType->getType();

Class extends undeclared class \OpenOrchestra\BaseApi\Transformer\AbstractTransformer
Open

class FieldTypeTransformer extends AbstractTransformer

Return type of transform() is undeclared type \OpenOrchestra\BaseApi\Facade\FacadeInterface
Open

    public function transform($fieldType, array $params = array())

Avoid excessively long variable names like $multiLanguagesChoiceManagerInterface. Keep variable name length under 20.
Open

    protected $multiLanguagesChoiceManagerInterface;

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Avoid excessively long variable names like $multiLanguagesChoiceManagerInterface. Keep variable name length under 20.
Open

        MultiLanguagesChoiceManagerInterface $multiLanguagesChoiceManagerInterface,

LongVariable

Since: 0.2

Detects when a field, formal or local variable is declared with a long name.

Example

class Something {
    protected $reallyLongIntName = -3; // VIOLATION - Field
    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
        $otherReallyLongName = -5; // VIOLATION - Local
        for ($interestingIntIndex = 0; // VIOLATION - For
             $interestingIntIndex < 10;
             $interestingIntIndex++ ) {
        }
    }
}

Source https://phpmd.org/rules/naming.html#longvariable

Inline control structures are not allowed
Open

            if (!is_string($value))

Line exceeds 120 characters; contains 222 characters
Open

        $facade->search = array_key_exists($fieldType->getType(), $this->fieldsParameters) && isset($this->fieldsParameters[$fieldType->getType()]['search']) ? $this->fieldsParameters[$fieldType->getType()]['search'] : '';

There are no issues that match your filters.

Category
Status