save accesses the super-global variable $_POST. Open
private function save()
{
if (!is_admin()) {
return;
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
save accesses the super-global variable $_POST. Open
private function save()
{
if (!is_admin()) {
return;
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
save accesses the super-global variable $_POST. Open
private function save()
{
if (!is_admin()) {
return;
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
save accesses the super-global variable $_GET. Open
private function save()
{
if (!is_admin()) {
return;
}
- Read upRead up
- Exclude checks
Superglobals
Since: 0.2
Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.
Example
class Foo {
public function bar() {
$name = $_POST['foo'];
}
}
Source
File metaslider.class.php
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Generic Slider super class. Extended by library specific classes.
*
The class MetaSlider has an overall complexity of 72 which is very high. The configured complexity threshold is 50. Open
class MetaSlider
{
public $id = 0; // slider ID
public $identifier = 0; // unique identifier
public $slides = []; //slides belonging to this slider
- Exclude checks
MetaSlider
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class MetaSlider
{
public $id = 0; // slider ID
public $identifier = 0; // unique identifier
public $slides = []; //slides belonging to this slider
Method get_default_parameters
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_default_parameters()
{
$params = [
'type' => 'flex',
'random' => false,
Function get_javascript_parameters
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function get_javascript_parameters()
{
$options = [];
// construct an array of all parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function populate_slides
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function populate_slides()
{
$slides = [];
$query = $this->get_slides();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_setting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function get_setting($name)
{
if (!isset($this->settings[$name])) {
$defaults = $this->get_default_parameters();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = '<!-- meta slider -->';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' ' . $this->get_inline_javascript();
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' <script type="text/javascript">';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' ' . $this->get_html();
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' </div>';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$pairs' which will lead to PHP notices. Open
$pairs[] = "{$key}:{$value}";
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' ' . $this->get_inline_css();
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = '</div>';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$pairs' which will lead to PHP notices. Open
$pairs[] = "{$key}: function($arg) {\n " . implode("\n ", $value) . "\n }";
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' ' . $this->get_html_after();
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = '<!--// meta slider-->';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' <div id="' . $this->get_container_id() . '">';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = '<div style="' . $this->get_container_style() . '" class="' . $this->get_container_class() . '">';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$html[] = ' </script>';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$html' which will lead to PHP notices. Open
$slideshow = implode("\n", $html);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$pairs' which will lead to PHP notices. Open
return implode(",\n ", $pairs);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Missing class import via use statement (line '183', column '22'). Open
$query = new WP_Query($args);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method get_setting uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (mb_strlen($this->settings[$name]) > 0) {
return $this->settings[$name];
}
}
- 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
Avoid using static access to class '\Xmf\Request' in method 'save'. Open
if (\Xmf\Request::hasVar('attachment', 'POST')) {
- Read upRead up
- Exclude checks
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
The method get_javascript_parameters uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$options[$param] = '"' . $val . '"';
}
- 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
The method populate_slides uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$slides[] = $return;
}
- 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
Avoid using static access to class '\Xmf\Request' in method 'save'. Open
if (\Xmf\Request::hasVar('title', 'POST')) {
- Read upRead up
- Exclude checks
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
Avoid using static access to class '\Xmf\Request' in method 'save'. Open
if (\Xmf\Request::hasVar('deleteSlide', 'GET')) {
- Read upRead up
- Exclude checks
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
The method get_javascript_parameters uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pairs[] = "{$key}:{$value}";
}
- 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
The method update_settings uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$new_settings[$checkbox] = 'false';
}
- 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
Avoid using static access to class '\Xmf\Request' in method 'save'. Open
if (\Xmf\Request::hasVar('settings', 'POST')) {
- Read upRead up
- Exclude checks
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
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class MetaSlider
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
public $id = 0; // slider ID
- 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 $slide_id is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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
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
The parameter $new_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->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 $shortcode_settings is not named in camelCase. Open
public function __construct($id, $shortcode_settings)
{
$this->id = $id;
$this->settings = array_merge($shortcode_settings, $this->get_settings());
$this->identifier = 'metaslider_' . $this->id;
- 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 "MetaSlider::get_html_after" is not in camel caps format Open
private function get_html_after()
- Exclude checks
Method name "MetaSlider::update_settings" is not in camel caps format Open
public function update_settings($new_settings)
- Exclude checks
Method name "MetaSlider::render_admin_slides" is not in camel caps format Open
public function render_admin_slides()
- Exclude checks
Method name "MetaSlider::get_inline_css" is not in camel caps format Open
private function get_inline_css()
- Exclude checks
Method name "MetaSlider::update_slides" is not in camel caps format Open
private function update_slides($data)
- Exclude checks
Method name "MetaSlider::get_settings" is not in camel caps format Open
private function get_settings()
- Exclude checks
Method name "MetaSlider::get_inline_javascript" is not in camel caps format Open
private function get_inline_javascript()
- Exclude checks
Method name "MetaSlider::update_title" is not in camel caps format Open
private function update_title($title)
- Exclude checks
Method name "MetaSlider::get_container_class" is not in camel caps format Open
private function get_container_class()
- Exclude checks
Method name "MetaSlider::get_container_style" is not in camel caps format Open
private function get_container_style()
- Exclude checks
Method name "MetaSlider::delete_slide" is not in camel caps format Open
private function delete_slide($slide_id)
- Exclude checks
Method name "MetaSlider::get_slides" is not in camel caps format Open
public function get_slides()
- Exclude checks
Method name "MetaSlider::populate_slides" is not in camel caps format Open
private function populate_slides()
- Exclude checks
Method name "MetaSlider::render_public_slides" is not in camel caps format Open
public function render_public_slides()
- Exclude checks
Method name "MetaSlider::get_custom_javascript_before" is not in camel caps format Open
private function get_custom_javascript_before()
- Exclude checks
Method name "MetaSlider::get_setting" is not in camel caps format Open
public function get_setting($name)
- Exclude checks
Method name "MetaSlider::get_identifier" is not in camel caps format Open
protected function get_identifier()
- Exclude checks
Method name "MetaSlider::get_container_id" is not in camel caps format Open
private function get_container_id()
- Exclude checks
Method name "MetaSlider::enqueue_scripts" is not in camel caps format Open
public function enqueue_scripts()
- Exclude checks
Method name "MetaSlider::get_custom_javascript_after" is not in camel caps format Open
private function get_custom_javascript_after()
- Exclude checks
Method name "MetaSlider::get_javascript_parameters" is not in camel caps format Open
private function get_javascript_parameters()
- Exclude checks
Method name "MetaSlider::get_default_parameters" is not in camel caps format Open
public function get_default_parameters()
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
if (('true' === $this->get_setting('carouselMode') || 'true' === $this->get_setting('fullWidth')) && ('coin' !== $this->get_setting('type'))) {
- Exclude checks
Line exceeds 120 characters; contains 133 characters Open
if (is_array($settings) && isset($settings['type']) && in_array($settings['type'], ['flex', 'coin', 'nivo', 'responsive'])) {
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
wp_enqueue_script('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->js_path, ['jquery'], METASLIDER_VERSION);
- Exclude checks
Line exceeds 120 characters; contains 184 characters Open
$checkboxes = ['noConflict', 'fullWidth', 'hoverPause', 'links', 'reverse', 'random', 'printCss', 'printJs', 'smoothHeight', 'center', 'smartCrop', 'carouselMode', 'autoPlay'];
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$pairs[] = "{$key}: function($arg) {\n " . implode("\n ", $value) . "\n }";
- Exclude checks
Line exceeds 120 characters; contains 223 characters Open
$script .= "\n var slider = !window.jQuery ? window.setTimeout(timer_{$this->identifier}, 100) : !jQuery.isReady ? window.setTimeout(timer_{$this->identifier}, 100) : {$this->identifier}(window.jQuery);";
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
wp_enqueue_style('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->css_path, false, METASLIDER_VERSION);
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
wp_enqueue_style('metaslider-public', METASLIDER_ASSETS_URL . 'metaslider/public.css', false, METASLIDER_VERSION);
- Exclude checks
The variable $new_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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 $container_id is not named in camelCase. Open
private function get_container_id()
{
$container_id = 'metaslider_container_' . $this->id;
$id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);
- 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 $custom_js_after is not named in camelCase. Open
private function get_inline_javascript()
{
$custom_js_before = $this->get_custom_javascript_before();
$custom_js_after = $this->get_custom_javascript_after();
- 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 $custom_js is not named in camelCase. Open
private function get_custom_javascript_before()
{
$type = $this->get_setting('type');
$javascript = '';
- 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 $old_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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 $current_terms is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $custom_js is not named in camelCase. Open
private function get_custom_javascript_before()
{
$type = $this->get_setting('type');
$javascript = '';
- 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 $new_terms is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $new_terms is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $container_id is not named in camelCase. Open
private function get_container_id()
{
$container_id = 'metaslider_container_' . $this->id;
$id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);
- 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 $new_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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)
{
$this->id = $id;
$this->settings = array_merge($shortcode_settings, $this->get_settings());
$this->identifier = 'metaslider_' . $this->id;
- 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 $custom_js_before is not named in camelCase. Open
private function get_inline_javascript()
{
$custom_js_before = $this->get_custom_javascript_before();
$custom_js_after = $this->get_custom_javascript_after();
- 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 $custom_js is not named in camelCase. Open
private function get_custom_javascript_after()
{
$type = $this->get_setting('type');
$custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);
- 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 $custom_js_after is not named in camelCase. Open
private function get_inline_javascript()
{
$custom_js_before = $this->get_custom_javascript_before();
$custom_js_after = $this->get_custom_javascript_after();
- 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 $current_term is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $custom_js is not named in camelCase. Open
private function get_custom_javascript_before()
{
$type = $this->get_setting('type');
$javascript = '';
- 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 $custom_js is not named in camelCase. Open
private function get_custom_javascript_after()
{
$type = $this->get_setting('type');
$custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);
- 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 $new_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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 $current_term is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $new_terms is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $slide_id is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $custom_js_before is not named in camelCase. Open
private function get_inline_javascript()
{
$custom_js_before = $this->get_custom_javascript_before();
$custom_js_after = $this->get_custom_javascript_after();
- 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 $custom_js is not named in camelCase. Open
private function get_custom_javascript_after()
{
$type = $this->get_setting('type');
$custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);
- 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 $current_terms is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $old_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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 $new_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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 $new_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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 $slide_id is not named in camelCase. Open
private function update_slides($data)
{
foreach ($data as $slide_id => $fields) {
do_action("metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields);
}
- 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 $current_term is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $slide_id is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 $slide_id is not named in camelCase. Open
private function update_slides($data)
{
foreach ($data as $slide_id => $fields) {
do_action("metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields);
}
- 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_slides is not named in camelCase. Open
public function get_slides()
{
$args = [
'force_no_custom_order' => true,
'orderby' => 'menu_order',
- 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 render_public_slides is not named in camelCase. Open
public function render_public_slides()
{
$html[] = '<!-- meta slider -->';
$html[] = '<div style="' . $this->get_container_style() . '" class="' . $this->get_container_class() . '">';
$html[] = ' ' . $this->get_inline_css();
- 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_custom_javascript_after is not named in camelCase. Open
private function get_custom_javascript_after()
{
$type = $this->get_setting('type');
$custom_js = apply_filters("metaslider_{$type}_slider_javascript", '', $this->id);
- 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 delete_slide is not named in camelCase. Open
private function delete_slide($slide_id)
{
// Get the existing terms and only keep the ones we don't want removed
$new_terms = [];
$current_terms = wp_get_object_terms($slide_id, 'ml-slider', ['fields' => 'ids']);
- 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 render_admin_slides is not named in camelCase. Open
public function render_admin_slides()
{
foreach ($this->slides as $slide) {
echo $slide;
}
- 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 update_slides is not named in camelCase. Open
private function update_slides($data)
{
foreach ($data as $slide_id => $fields) {
do_action("metaslider_save_{$fields['type']}_slide", $slide_id, $this->id, $fields);
}
- 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_after is not named in camelCase. Open
private function get_html_after()
{
$type = $this->get_setting('type');
$html = apply_filters("metaslider_{$type}_slider_html_after", '', $this->id, $this->settings);
- 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()
{
if ('true' === $this->get_setting('printJs')) {
wp_enqueue_script('metaslider-' . $this->get_setting('type') . '-slider', METASLIDER_ASSETS_URL . $this->js_path, ['jquery'], METASLIDER_VERSION);
}
- 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 populate_slides is not named in camelCase. Open
private function populate_slides()
{
$slides = [];
$query = $this->get_slides();
- 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_container_style is not named in camelCase. Open
private function get_container_style()
{
// default
$style = "max-width: {$this->get_setting('width')}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 update_title is not named in camelCase. Open
private function update_title($title)
{
$slide = [
'ID' => $this->id,
'post_title' => $title,
- 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_inline_javascript is not named in camelCase. Open
private function get_inline_javascript()
{
$custom_js_before = $this->get_custom_javascript_before();
$custom_js_after = $this->get_custom_javascript_after();
- 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_javascript_parameters is not named in camelCase. Open
private function get_javascript_parameters()
{
$options = [];
// construct an array of all parameters
- 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_settings is not named in camelCase. Open
private function get_settings()
{
$settings = get_post_meta($this->id, 'ml-slider_settings', true);
if (is_array($settings) && isset($settings['type']) && in_array($settings['type'], ['flex', 'coin', 'nivo', 'responsive'])) {
- 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_container_id is not named in camelCase. Open
private function get_container_id()
{
$container_id = 'metaslider_container_' . $this->id;
$id = apply_filters('metaslider_container_id', $container_id, $this->id, $this->settings);
- 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_inline_css is not named in camelCase. Open
private function get_inline_css()
{
$css = apply_filters('metaslider_css', '', $this->settings, $this->id);
// use this to add the scoped attribute for HTML5 validation (if needed)
- 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_setting is not named in camelCase. Open
public function get_setting($name)
{
if (!isset($this->settings[$name])) {
$defaults = $this->get_default_parameters();
- 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_custom_javascript_before is not named in camelCase. Open
private function get_custom_javascript_before()
{
$type = $this->get_setting('type');
$javascript = '';
- 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 update_settings is not named in camelCase. Open
public function update_settings($new_settings)
{
$old_settings = $this->get_settings();
// convert submitted checkbox values from 'on' or 'off' to boolean values
- 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_default_parameters is not named in camelCase. Open
public function get_default_parameters()
{
$params = [
'type' => 'flex',
'random' => 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() {
}
}
Source
The method get_identifier is not named in camelCase. Open
protected function get_identifier()
{
return $this->identifier;
}
- 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_container_class is not named in camelCase. Open
private function get_container_class()
{
$class = "metaslider metaslider-{$this->get_setting('type')} metaslider-{$this->id} ml-slider";
// apply the css class setting
- 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() {
}
}