mambax7/extgallery

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

Summary

Maintainability
A
0 mins
Test Coverage

Avoid unused parameters such as '$slider_id'.
Open

    public function set_autoplay_parameter($options, $slider_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

Avoid unused parameters such as '$settings'.
Open

    public function set_autoplay_parameter($options, $slider_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

Avoid unused local variables such as '$wp_filter'.
Open

        global $wp_filter;

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

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

            } else {
                $options['manualAdvance'] = 'true';
            }

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 MetaNivoSlider extends MetaSlider

The parameter $slider_id is not named in camelCase.
Open

    public function set_autoplay_parameter($options, $slider_id, $settings)
    {
        global $wp_filter;
        if (isset($options['autoPlay'])) {
            if ('true' === $options['autoPlay']) {

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 $shortcode_settings is not named in camelCase.
Open

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

        add_filter('metaslider_nivo_slider_parameters', [$this, 'set_autoplay_parameter'], 10, 3);

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

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

The property $js_function is not named in camelCase.
Open

class MetaNivoSlider extends MetaSlider
{
    protected $js_function = 'nivoSlider';
    protected $js_path     = 'sliders/nivoslider/jquery.nivo.slider.pack.js';
    protected $css_path    = 'sliders/nivoslider/nivo-slider.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 $css_path is not named in camelCase.
Open

class MetaNivoSlider extends MetaSlider
{
    protected $js_function = 'nivoSlider';
    protected $js_path     = 'sliders/nivoslider/jquery.nivo.slider.pack.js';
    protected $css_path    = 'sliders/nivoslider/nivo-slider.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 $js_path is not named in camelCase.
Open

class MetaNivoSlider extends MetaSlider
{
    protected $js_function = 'nivoSlider';
    protected $js_path     = 'sliders/nivoslider/jquery.nivo.slider.pack.js';
    protected $css_path    = 'sliders/nivoslider/nivo-slider.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

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

    public function enqueue_scripts()

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

    protected function get_html()

Method name "MetaNivoSlider::set_autoplay_parameter" is not in camel caps format
Open

    public function set_autoplay_parameter($options, $slider_id, $settings)

Method name "MetaNivoSlider::get_theme" is not in camel caps format
Open

    private function get_theme()

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

    protected function get_param($param)

Line exceeds 120 characters; contains 197 characters
Open

            wp_enqueue_style('metaslider-' . $this->get_setting('type') . '-slider-' . $theme, METASLIDER_ASSETS_URL . "sliders/nivoslider/themes/{$theme}/{$theme}.css", false, METASLIDER_VERSION);

The variable $wp_filter is not named in camelCase.
Open

    public function set_autoplay_parameter($options, $slider_id, $settings)
    {
        global $wp_filter;
        if (isset($options['autoPlay'])) {
            if ('true' === $options['autoPlay']) {

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()
    {
        $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
        $return_value .= "\n            <div class='ribbon'></div>";
        $return_value .= "\n            <div id='" . $this->get_identifier() . "' class='nivoSlider'>";

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()
    {
        $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
        $return_value .= "\n            <div class='ribbon'></div>";
        $return_value .= "\n            <div id='" . $this->get_identifier() . "' class='nivoSlider'>";

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()
    {
        $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
        $return_value .= "\n            <div class='ribbon'></div>";
        $return_value .= "\n            <div id='" . $this->get_identifier() . "' class='nivoSlider'>";

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()
    {
        $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
        $return_value .= "\n            <div class='ribbon'></div>";
        $return_value .= "\n            <div id='" . $this->get_identifier() . "' class='nivoSlider'>";

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()
    {
        $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
        $return_value .= "\n            <div class='ribbon'></div>";
        $return_value .= "\n            <div id='" . $this->get_identifier() . "' class='nivoSlider'>";

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()
    {
        $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
        $return_value .= "\n            <div class='ribbon'></div>";
        $return_value .= "\n            <div id='" . $this->get_identifier() . "' class='nivoSlider'>";

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_nivo_slider_parameters', [$this, 'set_autoplay_parameter'], 10, 3);

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'         => 'effect',
            'slices'         => 'slices',

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_theme is not named in camelCase.
Open

    private function get_theme()
    {
        $theme = $this->get_setting('theme');

        if (!in_array($theme, ['dark', 'bar', 'light'])) {

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()
    {
        $return_value = "<div class='slider-wrapper theme-{$this->get_theme()}'>";
        $return_value .= "\n            <div class='ribbon'></div>";
        $return_value .= "\n            <div id='" . $this->get_identifier() . "' class='nivoSlider'>";

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 set_autoplay_parameter is not named in camelCase.
Open

    public function set_autoplay_parameter($options, $slider_id, $settings)
    {
        global $wp_filter;
        if (isset($options['autoPlay'])) {
            if ('true' === $options['autoPlay']) {

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('printCss')) {

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