mambax7/extgallery

View on GitHub
assets/js/ml-slider/inc/slider/metaslider.flex.class.php

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$slider_id'.
Open

    public function enable_easing($options, $slider_id)

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

Avoid unused parameters such as '$slider_id'.
Open

    public function enable_carousel_mode($options, $slider_id)

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

Avoid unused parameters such as '$id'.
Open

    public function remove_bottom_margin($class, $id, $settings)

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

The method get_html uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $return_value .= "\n                <li style=\"display: none;\">" . $slide . '</li>';
            }

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

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

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class MetaFlexSlider extends MetaSlider

The property $css_path is not named in camelCase.
Open

class MetaFlexSlider extends MetaSlider
{
    protected $js_function          = 'flexslider';
    protected $js_path              = 'sliders/flexslider/jquery.flexslider-min.js';
    protected $css_path             = 'sliders/flexslider/flexslider.css';

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

Avoid variables with short names like $id. Configured minimum length is 3.
Open

    public function __construct($id, $shortcode_settings)

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

Avoid variables with short names like $id. Configured minimum length is 3.
Open

    public function remove_bottom_margin($class, $id, $settings)

ShortVariable

Since: 0.2

Detects when a field, local, or parameter has a very short name.

Example

class Something {
    private $q = 15; // VIOLATION - Field
    public static function main( array $as ) { // VIOLATION - Formal
        $r = 20 + $this->q; // VIOLATION - Local
        for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
            $r += $this->q;
        }
    }
}

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

The parameter $slider_id is not named in camelCase.
Open

    public function get_carousel_css($css, $settings, $slider_id)
    {
        if (isset($settings['carouselMode']) && 'true' === $settings['carouselMode']) {
            $css .= "\n        #metaslider_{$slider_id}.flexslider li {margin-right: {$this->carousel_item_margin}px;}";
        }

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The property $js_function is not named in camelCase.
Open

class MetaFlexSlider extends MetaSlider
{
    protected $js_function          = 'flexslider';
    protected $js_path              = 'sliders/flexslider/jquery.flexslider-min.js';
    protected $css_path             = 'sliders/flexslider/flexslider.css';

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The property $carousel_item_margin is not named in camelCase.
Open

class MetaFlexSlider extends MetaSlider
{
    protected $js_function          = 'flexslider';
    protected $js_path              = 'sliders/flexslider/jquery.flexslider-min.js';
    protected $css_path             = 'sliders/flexslider/flexslider.css';

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The parameter $shortcode_settings is not named in camelCase.
Open

    public function __construct($id, $shortcode_settings)
    {
        parent::__construct($id, $shortcode_settings);

        add_filter('metaslider_flex_slider_parameters', [$this, 'enable_carousel_mode'], 10, 2);

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The property $js_path is not named in camelCase.
Open

class MetaFlexSlider extends MetaSlider
{
    protected $js_function          = 'flexslider';
    protected $js_path              = 'sliders/flexslider/jquery.flexslider-min.js';
    protected $css_path             = 'sliders/flexslider/flexslider.css';

CamelCasePropertyName

Since: 0.2

It is considered best practice to use the camelCase notation to name attributes.

Example

class ClassName {
    protected $property_name;
}

Source

The parameter $slider_id is not named in camelCase.
Open

    public function enable_easing($options, $slider_id)
    {
        if (isset($options['easing'])) {
            $options['useCSS'] = 'false';
        }

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $slider_id is not named in camelCase.
Open

    public function enable_carousel_mode($options, $slider_id)
    {
        if (isset($options['carouselMode'])) {
            if ('true' === $options['carouselMode']) {
                $options['itemWidth']  = $this->get_setting('width');

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

Method name "MetaFlexSlider::enable_easing" is not in camel caps format
Open

    public function enable_easing($options, $slider_id)

Method name "MetaFlexSlider::enable_carousel_mode" is not in camel caps format
Open

    public function enable_carousel_mode($options, $slider_id)

Method name "MetaFlexSlider::get_html" is not in camel caps format
Open

    protected function get_html()

Method name "MetaFlexSlider::get_carousel_css" is not in camel caps format
Open

    public function get_carousel_css($css, $settings, $slider_id)

Method name "MetaFlexSlider::remove_bottom_margin" is not in camel caps format
Open

    public function remove_bottom_margin($class, $id, $settings)

Method name "MetaFlexSlider::get_param" is not in camel caps format
Open

    protected function get_param($param)

Method name "MetaFlexSlider::enqueue_scripts" is not in camel caps format
Open

    public function enqueue_scripts()

Line exceeds 120 characters; contains 138 characters
Open

            wp_enqueue_script('metaslider-easing', METASLIDER_ASSETS_URL . 'easing/jQuery.easing.min.js', ['jquery'], METASLIDER_VERSION);

The variable $return_value is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $slider_id is not named in camelCase.
Open

    public function get_carousel_css($css, $settings, $slider_id)
    {
        if (isset($settings['carouselMode']) && 'true' === $settings['carouselMode']) {
            $css .= "\n        #metaslider_{$slider_id}.flexslider li {margin-right: {$this->carousel_item_margin}px;}";
        }

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $return_value is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $return_value is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $return_value is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $shortcode_settings is not named in camelCase.
Open

    public function __construct($id, $shortcode_settings)
    {
        parent::__construct($id, $shortcode_settings);

        add_filter('metaslider_flex_slider_parameters', [$this, 'enable_carousel_mode'], 10, 2);

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $return_value is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $return_value is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $return_value is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The method get_param is not named in camelCase.
Open

    protected function get_param($param)
    {
        $params = [
            'effect'         => 'animation',
            'direction'      => 'direction',

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method get_html is not named in camelCase.
Open

    protected function get_html()
    {
        $class = 'true' === $this->get_setting('noConflict') ? '' : ' class="flexslider"';

        $return_value = '<div id="' . $this->get_identifier() . '"' . $class . '>';

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method get_carousel_css is not named in camelCase.
Open

    public function get_carousel_css($css, $settings, $slider_id)
    {
        if (isset($settings['carouselMode']) && 'true' === $settings['carouselMode']) {
            $css .= "\n        #metaslider_{$slider_id}.flexslider li {margin-right: {$this->carousel_item_margin}px;}";
        }

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method enable_carousel_mode is not named in camelCase.
Open

    public function enable_carousel_mode($options, $slider_id)
    {
        if (isset($options['carouselMode'])) {
            if ('true' === $options['carouselMode']) {
                $options['itemWidth']  = $this->get_setting('width');

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method remove_bottom_margin is not named in camelCase.
Open

    public function remove_bottom_margin($class, $id, $settings)
    {
        if (isset($settings['navigation']) && 'false' === $settings['navigation']) {
            return $class .= ' nav-hidden';
        }

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method enqueue_scripts is not named in camelCase.
Open

    public function enqueue_scripts()
    {
        parent::enqueue_scripts();

        if ('true' === $this->get_setting('printJs')) {

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

The method enable_easing is not named in camelCase.
Open

    public function enable_easing($options, $slider_id)
    {
        if (isset($options['easing'])) {
            $options['useCSS'] = 'false';
        }

CamelCaseMethodName

Since: 0.2

It is considered best practice to use the camelCase notation to name methods.

Example

class ClassName {
    public function get_name() {
    }
}

Source

There are no issues that match your filters.

Category
Status