Issues (1386)

model/button.php (202 issues)

1
<?php
0 ignored issues
show
Class file names should be based on the class name with "class-" prepended. Expected class-button.php, but found button.php.
Loading history...
This file is missing a doc comment.
Loading history...
2
namespace PodloveSubscribeButton\Model;
3
4
class Button extends Base {
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
5
6
	public static $properties = array(
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
7
		// $property => $default value
8
		'size' => 'big',
0 ignored issues
show
Array double arrow not aligned correctly; expected 6 space(s) between "'size'" and double arrow, but found 1.
Loading history...
9
		'color' => '#599677',
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'color'" and double arrow, but found 1.
Loading history...
10
		'autowidth' => 'on',
11
		'style' => 'filled',
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'style'" and double arrow, but found 1.
Loading history...
12
		'format' => 'rectangle',
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'format'" and double arrow, but found 1.
Loading history...
13
		'hide' => 'false',
0 ignored issues
show
Array double arrow not aligned correctly; expected 6 space(s) between "'hide'" and double arrow, but found 1.
Loading history...
14
		'buttonid' => ''
0 ignored issues
show
Array double arrow not aligned correctly; expected 2 space(s) between "'buttonid'" and double arrow, but found 1.
Loading history...
Each array item in a multi-line array declaration must end in a comma
Loading history...
15
		// Note: the fields 'language' and 'json-data' cannot be set here (No function call allowed within class variables)
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
16
	);
17
18
	public static $style = array(
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
19
		'filled' => 'Filled',
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'filled'" and double arrow, but found 1.
Loading history...
20
		'outline' => 'Outline',
0 ignored issues
show
Array double arrow not aligned correctly; expected 3 space(s) between "'outline'" and double arrow, but found 1.
Loading history...
21
		'frameless' => 'Frameless'
0 ignored issues
show
Each array item in a multi-line array declaration must end in a comma
Loading history...
22
	);
23
24
	public static $format = array(
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
25
		'rectangle' => 'Rectangle',
26
		'square' => 'Square',
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'square'" and double arrow, but found 1.
Loading history...
27
		'cover' => 'Cover'
0 ignored issues
show
Array double arrow not aligned correctly; expected 5 space(s) between "'cover'" and double arrow, but found 1.
Loading history...
Each array item in a multi-line array declaration must end in a comma
Loading history...
28
	);
29
30
	public static $width = array(
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
31
		'on' => 'Yes',
0 ignored issues
show
Array double arrow not aligned correctly; expected 2 space(s) between "'on'" and double arrow, but found 1.
Loading history...
32
		'off' => 'No'
0 ignored issues
show
Each array item in a multi-line array declaration must end in a comma
Loading history...
33
	);
34
35
	public static $size = array(
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
36
		'small' => 'Small',
0 ignored issues
show
Array double arrow not aligned correctly; expected 2 space(s) between "'small'" and double arrow, but found 1.
Loading history...
37
		'medium' => 'Medium',
38
		'big' => 'Big'
0 ignored issues
show
Array double arrow not aligned correctly; expected 4 space(s) between "'big'" and double arrow, but found 1.
Loading history...
Each array item in a multi-line array declaration must end in a comma
Loading history...
39
	);
40
41
42
	/**
43
	 * Fetches a Button or Network Button with a specific name
44
	 * @param  string $name
0 ignored issues
show
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
45
	 * @return object||FALSE
0 ignored issues
show
Documentation Bug introduced by
The doc comment object||FALSE at position 2 could not be parsed: Unknown type name '|' at position 2 in object||FALSE.
Loading history...
46
	 */
47
	public static function get_button_by_name($name) {
0 ignored issues
show
Expected 1 spaces between opening bracket and argument "$name"; 0 found
Loading history...
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
48
		if ( $button = \PodloveSubscribeButton\Model\Button::find_one_by_property('name', $name) ) {
0 ignored issues
show
Variable assignment found within a condition. Did you mean to do a comparison?
Loading history...
Assignments must be the first block of code on a line
Loading history...
As per coding style, self should be used for accessing local static members.

This check looks for accesses to local static members using the fully qualified name instead of self::.

<?php

class Certificate {
    const TRIPLEDES_CBC = 'ASDFGHJKL';

    private $key;

    public function __construct()
    {
        $this->key = Certificate::TRIPLEDES_CBC;
    }
}

While this is perfectly valid, the fully qualified name of Certificate::TRIPLEDES_CBC could just as well be replaced by self::TRIPLEDES_CBC. Referencing local members with self:: assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.

Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
49
			return $button;
50
		}
51
52
		if ( $network_button = \PodloveSubscribeButton\Model\NetworkButton::find_one_by_property('name', $name) ) {
0 ignored issues
show
Variable assignment found within a condition. Did you mean to do a comparison?
Loading history...
Assignments must be the first block of code on a line
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
53
			$network_button->id = $network_button->id . 'N';
54
			return $network_button;
55
		}
56
57
		return false;
58
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
59
60
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$settings" missing
Loading history...
61
	 * Returns either global buttons settings or the default settings 
62
	 * @param  array
0 ignored issues
show
There must be exactly one blank line before the tags in a doc comment
Loading history...
Missing parameter name
Loading history...
63
	 * @return array
64
	 */
65
	public static function get_global_setting_with_fallback( $settings=array() ) {
0 ignored issues
show
Incorrect spacing between argument "$settings" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$settings"; expected 1 but found 0
Loading history...
66
		foreach (self::$properties as $property => $default) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
67
			$settings[$property] = ( get_option('podlove_subscribe_button_default_' . $property) ? get_option('podlove_subscribe_button_default_' . $property) : $default );
0 ignored issues
show
Array keys must be surrounded by spaces unless they contain a string or an integer.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
68
		}
69
70
		return $settings;
71
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
72
73
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$language" missing
Loading history...
74
	 * Gathers all information and renders the Subscribe button.
75
	 * @param  string  $size
0 ignored issues
show
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
76
	 * @param  string  $autowidth
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
77
	 * @param  string  $style
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
78
	 * @param  string  $format
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
79
	 * @param  string  $color
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
80
	 * @param  boolean $hide
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
81
	 * @param  boolean $buttonid
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
82
	 * @return string
83
	 */
84
	public function render( $size='big', $autowidth='on', $style='filled', $format='rectangle', $color='#599677', $hide = false, $buttonid = false, $language='en' ) {
0 ignored issues
show
Incorrect spacing between argument "$size" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$size"; expected 1 but found 0
Loading history...
Incorrect spacing between argument "$autowidth" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$autowidth"; expected 1 but found 0
Loading history...
Incorrect spacing between argument "$style" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$style"; expected 1 but found 0
Loading history...
Incorrect spacing between argument "$format" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$format"; expected 1 but found 0
Loading history...
Incorrect spacing between argument "$color" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$color"; expected 1 but found 0
Loading history...
Incorrect spacing between argument "$language" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$language"; expected 1 but found 0
Loading history...
85
		$button_styling = array_merge(
86
				$this->get_button_styling($size, $autowidth, $style, $format, $color),
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 16.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
87
				array(
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 12 spaces, but found 16.
Loading history...
88
						'hide' => $hide,
0 ignored issues
show
Array item not aligned correctly; expected 20 spaces but found 24
Loading history...
Array double arrow not aligned correctly; expected 5 space(s) between "'hide'" and double arrow, but found 1.
Loading history...
89
						'buttonid' => $buttonid,
0 ignored issues
show
Array item not aligned correctly; expected 20 spaces but found 24
Loading history...
90
						'language' => $language
0 ignored issues
show
Array item not aligned correctly; expected 20 spaces but found 24
Loading history...
Each array item in a multi-line array declaration must end in a comma
Loading history...
91
					)
0 ignored issues
show
Array closer not aligned correctly; expected 16 space(s) but found 20
Loading history...
92
			);
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 8 spaces, but found 12.
Loading history...
93
94
		return $this->provide_button_html(
95
			array(
96
				'title' => $this->title,
0 ignored issues
show
Bug Best Practice introduced by
The property title does not exist on PodloveSubscribeButton\Model\Button. Since you implemented __get, consider adding a @property annotation.
Loading history...
Array double arrow not aligned correctly; expected 7 space(s) between "'title'" and double arrow, but found 1.
Loading history...
97
				'subtitle' => $this->subtitle,
0 ignored issues
show
Bug Best Practice introduced by
The property subtitle does not exist on PodloveSubscribeButton\Model\Button. Since you implemented __get, consider adding a @property annotation.
Loading history...
Array double arrow not aligned correctly; expected 4 space(s) between "'subtitle'" and double arrow, but found 1.
Loading history...
98
				'description' => $this->description,
0 ignored issues
show
Bug Best Practice introduced by
The property description does not exist on PodloveSubscribeButton\Model\Button. Since you implemented __get, consider adding a @property annotation.
Loading history...
99
				'cover' => $this->cover,
0 ignored issues
show
Bug Best Practice introduced by
The property cover does not exist on PodloveSubscribeButton\Model\Button. Since you implemented __get, consider adding a @property annotation.
Loading history...
Array double arrow not aligned correctly; expected 7 space(s) between "'cover'" and double arrow, but found 1.
Loading history...
100
				'feeds' => $this->get_feeds_as_array($this->feeds)
0 ignored issues
show
Bug Best Practice introduced by
The property feeds does not exist on PodloveSubscribeButton\Model\Button. Since you implemented __get, consider adding a @property annotation.
Loading history...
Array double arrow not aligned correctly; expected 7 space(s) between "'feeds'" and double arrow, but found 1.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
Each array item in a multi-line array declaration must end in a comma
Loading history...
101
			), $button_styling );
0 ignored issues
show
This line of the multi-line function call does not seem to be indented correctly. Expected 8 spaces, but found 12.
Loading history...
102
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
103
104
	/** 
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$feeds" missing
Loading history...
105
	 * Provides the feed as an array in the required format
106
	 * @return array
0 ignored issues
show
There must be exactly one blank line before the tags in a doc comment
Loading history...
107
	 */
108
	private function get_feeds_as_array( $feeds=array() ) {
0 ignored issues
show
Incorrect spacing between argument "$feeds" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$feeds"; expected 1 but found 0
Loading history...
109
		foreach ($feeds as $feed) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
110
			if ( isset(\PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension']) ) {
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
Array keys must be surrounded by spaces unless they contain a string or an integer.
Loading history...
111
				$new_feed = array(
112
						'type' => 'audio',
0 ignored issues
show
Array item not aligned correctly; expected 20 spaces but found 24
Loading history...
Array double arrow not aligned correctly; expected 4 space(s) between "'type'" and double arrow, but found 1.
Loading history...
113
						'format' => \PodloveSubscribeButton\MediaTypes::$audio[$feed['format']]['extension'],
0 ignored issues
show
Array item not aligned correctly; expected 20 spaces but found 24
Loading history...
Array double arrow not aligned correctly; expected 2 space(s) between "'format'" and double arrow, but found 1.
Loading history...
Array keys must be surrounded by spaces unless they contain a string or an integer.
Loading history...
114
						'url' => $feed['url'],
0 ignored issues
show
Array item not aligned correctly; expected 20 spaces but found 24
Loading history...
Array double arrow not aligned correctly; expected 5 space(s) between "'url'" and double arrow, but found 1.
Loading history...
115
						'variant' => 'high'
0 ignored issues
show
Array item not aligned correctly; expected 20 spaces but found 24
Loading history...
Each array item in a multi-line array declaration must end in a comma
Loading history...
116
					);
0 ignored issues
show
Array closer not aligned correctly; expected 16 space(s) but found 20
Loading history...
117
118
				if ( isset($feed['itunesfeedid']) && $feed['itunesfeedid'] > 0 )
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
119
					$new_feed['directory-url-itunes'] = "https://itunes.apple.com/podcast/id" . $feed['itunesfeedid'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal https://itunes.apple.com/podcast/id does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
120
121
				$feeds[] = $new_feed;
122
			}
123
		}
124
125
		return $feeds;
126
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
127
128
	/** 
129
	 * Provides the HTML source of the Subscribe Button
130
	 * @param  array $podcast_data
0 ignored issues
show
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Expected 2 spaces after parameter type; 1 found
Loading history...
131
	 * @param  array $button_styling
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Expected 2 spaces after parameter type; 1 found
Loading history...
132
	 * @param  string $data_attributes
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
133
	 * @return string 
134
	 */
135
	private function provide_button_html($podcast_data, $button_styling, $data_attributes="") {
0 ignored issues
show
Expected 1 spaces between opening bracket and argument "$podcast_data"; 0 found
Loading history...
No space after opening parenthesis is prohibited
Loading history...
Incorrect spacing between argument "$data_attributes" and equals sign; expected 1 but found 0
Loading history...
Incorrect spacing between default value and equals sign for argument "$data_attributes"; expected 1 but found 0
Loading history...
Coding Style Comprehensibility introduced by
The string literal does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
No space before closing parenthesis is prohibited
Loading history...
136
		// Create data attributes for Button
0 ignored issues
show
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
137
		foreach ($button_styling as $attribute => $value) {
0 ignored issues
show
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
138
			$data_attributes .= 'data-' . $attribute . '="' . $value . '" ';
139
		}
140
141
		return"
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal \n <script>\n... podcastData does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Language constructs must be followed by a single space; expected "return "
" but found "return"
"
Loading history...
142
			<script>
143
				podcastData".$this->id . " = ".json_encode($podcast_data)."
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal \n </script>\...n/javascripts/app.js\" does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Concat operator must be surrounded by a single space
Loading history...
Coding Style Comprehensibility introduced by
The string literal = does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
json_encode() is discouraged. Use wp_json_encode() instead.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
144
			</script>
145
			<script 
146
				class=\"podlove-subscribe-button\" 
147
				src=\"https://cdn.podlove.org/subscribe-button/javascripts/app.js\" " . $data_attributes . ">
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal >\n </script>\n does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
148
			</script>
149
		";
150
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
151
152
	/**
153
	 * Returns an array with either the set or default values
154
	 * @param  string $size
0 ignored issues
show
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
155
	 * @param  string $autowidth
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
156
	 * @param  string $style
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
157
	 * @param  string $format
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
158
	 * @param  string $color
0 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
159
	 * @return array
160
	 */
161
	public function get_button_styling($size, $autowidth, $style, $format, $color) {
0 ignored issues
show
Expected 1 spaces between opening bracket and argument "$size"; 0 found
Loading history...
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
162
163
		return array(
164
				// $attribute => $value
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
Array item not aligned correctly; expected 12 spaces but found 16
Loading history...
165
				'size' => ( $size == 'default' ? get_option('podlove_subscribe_button_default_size', $size) : $size )
0 ignored issues
show
Are you sure $size == 'default' ? get...t_size', $size) : $size of type mixed|false|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

165
				'size' => ( /** @scrutinizer ignore-type */ $size == 'default' ? get_option('podlove_subscribe_button_default_size', $size) : $size )
Loading history...
Multi-line array item not aligned correctly; expected 12 spaces, but found 16
Loading history...
Array double arrow not aligned correctly; expected 6 space(s) between "'size'" and double arrow, but found 1.
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
166
			 	. self::interpret_autowidth_attribute($autowidth),
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
167
				'style' => ( $style == 'default' ? get_option('podlove_subscribe_button_default_style', $style) : $style ),
0 ignored issues
show
Array item not aligned correctly; expected 12 spaces but found 16
Loading history...
Array double arrow not aligned correctly; expected 5 space(s) between "'style'" and double arrow, but found 1.
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
168
				'format' => ( $format == 'default' ? get_option('podlove_subscribe_button_default_format', $format) : $format ),
0 ignored issues
show
Array item not aligned correctly; expected 12 spaces but found 16
Loading history...
Array double arrow not aligned correctly; expected 4 space(s) between "'format'" and double arrow, but found 1.
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
169
				'color' => ( isset($color) ? $color : get_option('podlove_subscribe_button_default_color', $color) ),
0 ignored issues
show
Array item not aligned correctly; expected 12 spaces but found 16
Loading history...
Array double arrow not aligned correctly; expected 5 space(s) between "'color'" and double arrow, but found 1.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
170
				'json-data' => 'podcastData' . $this->id
0 ignored issues
show
Array item not aligned correctly; expected 12 spaces but found 16
Loading history...
Each array item in a multi-line array declaration must end in a comma
Loading history...
171
			);
0 ignored issues
show
Array closer not aligned correctly; expected 8 space(s) but found 12
Loading history...
172
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
173
174
	/**
175
	 * Helper function to interpret the given $autowidth value correctly
176
	 * @param  string $autowidth
0 ignored issues
show
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
177
	 * @return string
178
	 */
179
	private static function interpret_autowidth_attribute($autowidth) {
0 ignored issues
show
Expected 1 spaces between opening bracket and argument "$autowidth"; 0 found
Loading history...
No space after opening parenthesis is prohibited
Loading history...
No space before closing parenthesis is prohibited
Loading history...
180
		if ( $autowidth == 'default' && get_option('podlove_subscribe_button_default_autowidth') !== 'on' )
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
Found: ==. Use strict comparisons (=== or !==).
Loading history...
Use Yoda Condition checks, you must.
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
181
			return '';
182
183
		if ( $autowidth !== 'default' && $autowidth !== 'on' )
0 ignored issues
show
Coding Style Best Practice introduced by
It is generally a best practice to always use braces with control structures.

Adding braces to control structures avoids accidental mistakes as your code changes:

// Without braces (not recommended)
if (true)
    doSomething();

// Recommended
if (true) {
    doSomething();
}
Loading history...
Use Yoda Condition checks, you must.
Loading history...
184
			return '';
185
186
		return ' auto';
187
	}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
188
}
189
190
Button::property( 'id', 'INT NOT NULL AUTO_INCREMENT PRIMARY KEY' );
191
Button::property( 'name', 'VARCHAR(255)' );
192
Button::property( 'title', 'VARCHAR(255)' );
193
Button::property( 'subtitle', 'VARCHAR(255)' );
194
Button::property( 'description', 'TEXT' );
195
Button::property( 'cover', 'VARCHAR(255)' );
196
Button::property( 'feeds', 'TEXT' );