Avoid unused parameters such as '$slider_id'. Open
public function enable_easing($options, $slider_id)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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>';
}
- Read upRead up
- Exclude checks
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
- Exclude checks
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';
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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;}";
}
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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';
- Read upRead up
- Exclude checks
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';
}
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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)
- Exclude checks
Method name "MetaFlexSlider::enable_carousel_mode" is not in camel caps format Open
public function enable_carousel_mode($options, $slider_id)
- Exclude checks
Method name "MetaFlexSlider::get_html" is not in camel caps format Open
protected function get_html()
- Exclude checks
Method name "MetaFlexSlider::get_carousel_css" is not in camel caps format Open
public function get_carousel_css($css, $settings, $slider_id)
- Exclude checks
Method name "MetaFlexSlider::remove_bottom_margin" is not in camel caps format Open
public function remove_bottom_margin($class, $id, $settings)
- Exclude checks
Method name "MetaFlexSlider::get_param" is not in camel caps format Open
protected function get_param($param)
- Exclude checks
Method name "MetaFlexSlider::enqueue_scripts" is not in camel caps format Open
public function enqueue_scripts()
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
wp_enqueue_script('metaslider-easing', METASLIDER_ASSETS_URL . 'easing/jQuery.easing.min.js', ['jquery'], METASLIDER_VERSION);
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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;}";
}
- Read upRead up
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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);
- Read upRead up
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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',
- Read upRead up
- Exclude checks
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 . '>';
- Read upRead up
- Exclude checks
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;}";
}
- Read upRead up
- Exclude checks
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');
- Read upRead up
- Exclude checks
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';
}
- Read upRead up
- Exclude checks
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')) {
- Read upRead up
- Exclude checks
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';
}
- Read upRead up
- Exclude checks
CamelCaseMethodName
Since: 0.2
It is considered best practice to use the camelCase notation to name methods.
Example
class ClassName {
public function get_name() {
}
}