GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( fc808e...eee123 )
by Christian
10s
created

Button_List_Table::column_id()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
introduced by
Filenames should be all lowercase with hyphens as word separators. Expected buttons-list-table.php, but found buttons_list_table.php.
Loading history...
introduced by
Class file names should be based on the class name with "class-" prepended. Expected class-button-list-table.php, but found buttons_list_table.php.
Loading history...
2
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
3
 * @author    Podlove <[email protected]>
4
 * @copyright Copyright (c) 2014-2018, Podlove
5
 * @license   https://github.com/podlove/podlove-subscribe-button-wp-plugin/blob/master/LICENSE MIT
6
 * @package   Podlove\PodloveSubscribeButton
7
 */
8
9
namespace PodloveSubscribeButton;
10
11
if ( ! class_exists( 'WP_List_Table' ) ) {
12
    require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
0 ignored issues
show
Coding Style introduced by
"require_once" is a statement not a function; no parentheses are required
Loading history...
13
}
14
15
class Button_List_Table extends \WP_List_Table {
0 ignored issues
show
Coding Style introduced by
Class name "Button_List_Table" is not in PascalCase format

Classes in PHP are usually named in CamelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. The whole name starts with a capital letter as well.

Thus the name database provider becomes DatabaseProvider.

Loading history...
Coding Style Documentation introduced by
Missing doc comment for class Button_List_Table
Loading history...
16
17
	public function __construct() {
0 ignored issues
show
Coding Style Documentation introduced by
Missing doc comment for function __construct()
Loading history...
18
19
		global $status, $page;
20
21
		// Set parent defaults
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
22
		parent::__construct( array(
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
23
			'singular' => 'feed', // singular name of the listed records
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
24
			'plural'   => 'feeds', // plural name of the listed records
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
25
			'ajax'     => false,  // does this table support ajax?
26
		) );
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
27
28
	}
29
30
	public function column_name( $button ) {
0 ignored issues
show
Coding Style introduced by
Method name "Button_List_Table::column_name" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function column_name()
Loading history...
31
32
		$actions = array(
33
			'edit'   => Settings\Buttons::get_action_link( $button, __( 'Edit', 'podlove-subscribe-button' ), 'edit' ),
34
			'delete' => Settings\Buttons::get_action_link( $button, __( 'Delete', 'podlove-subscribe-button' ), 'confirm_delete' )
0 ignored issues
show
introduced by
Each array item in a multi-line array declaration must end in a comma
Loading history...
35
		);
36
37
		return sprintf( '%1$s %2$s',
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
38
		    /*$1%s*/ $button->title . '<br><code>[podlove-subscribe-button button="' . $button->name . '"]</code>',
39
		    /*$3%s*/ $this->row_actions( $actions )
40
		);
41
42
	}
43
44
	public function column_button_preview( $button ) {
0 ignored issues
show
Coding Style introduced by
Method name "Button_List_Table::column_button_preview" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function column_button_preview()
Loading history...
45
46
		if ( ! $button->feeds ) {
47
			return '<code>' . __( 'No preview. Please set a feed.', 'podlove-subscribe-button' ) . '</code>';
48
		} else {
49
50
			$preview  = "<div class='podlove-button-preview-container'>";
51
			$preview .= $button->render(
52
				'big',
53
				'false',
54
				get_option( 'podlove_subscribe_button_default_style', 'filled' ),
55
				'rectangle'
56
			);
57
			$preview .= "</div>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal </div> 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...
58
59
			return $preview;
60
61
		}
62
63
	}
64
65
	public function column_id( $button ) {
0 ignored issues
show
Coding Style introduced by
Method name "Button_List_Table::column_id" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function column_id()
Loading history...
66
		return $button->id;
67
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
68
69
	public function get_columns() {
0 ignored issues
show
Coding Style introduced by
Method name "Button_List_Table::get_columns" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function get_columns()
Loading history...
70
		return array(
71
			'name'           => __( 'Title & Shortcode', 'podlove-subscribe-button' ),
72
			'button_preview' => __( 'Preview', 'podlove-subscribe-button' ),
73
		);
74
	}
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
75
76
	public function prepare_items() {
0 ignored issues
show
Coding Style introduced by
Method name "Button_List_Table::prepare_items" is not in camel caps format
Loading history...
Coding Style Documentation introduced by
Missing doc comment for function prepare_items()
Loading history...
77
78
		// number of items per page
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
79
		$per_page = 1000;
80
81
		// define column headers
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
82
		$columns = $this->get_columns();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 15 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
83
		$hidden = array();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 16 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
84
		$sortable = $this->get_sortable_columns();
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 14 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
85
		$this->_column_headers = array( $columns, $hidden, $sortable );
86
87
		// retrieve data
88
		// TODO select data for current page only
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
89
		$data = ( is_network_admin() ? \PodloveSubscribeButton\Model\NetworkButton::all() : \PodloveSubscribeButton\Model\Button::all() );
90
91
		// get current page
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
92
		$current_page = $this->get_pagenum();
93
		// get total items
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
94
		$total_items = count( $data );
95
		// extrage page for current page only
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
96
		$data = array_slice( $data, ( ( $current_page - 1 ) * $per_page ), $per_page );
97
		// add items to table
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
98
		$this->items = $data;
99
100
		// register pagination options & calculations
0 ignored issues
show
Coding Style introduced by
Inline comments must end in full-stops, exclamation marks, or question marks
Loading history...
101
		$this->set_pagination_args( array(
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
102
			'total_items' => $total_items,
103
			'per_page'    => $per_page,
104
			'total_pages' => ceil( $total_items / $per_page ),
105
		) );
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
106
107
	}
108
109
} // END class
110