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.

Freemius_Debug_Bar_Panel::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 21 and the first side effect is on line 10.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
	/**
3
	 * @package     Freemius
4
	 * @copyright   Copyright (c) 2015, Freemius, Inc.
5
	 * @license     https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6
	 * @since       1.1.7.3
7
	 */
8
9
	if ( ! defined( 'ABSPATH' ) ) {
10
		exit;
11
	}
12
13
	/**
14
	 * Extends Debug Bar plugin by adding a panel to show all Freemius API requests.
15
	 *
16
	 * @author Vova Feldman (@svovaf)
17
	 * @since  1.1.7.3
18
	 *
19
	 * Class Freemius_Debug_Bar_Panel
20
	 */
21
	class Freemius_Debug_Bar_Panel extends Debug_Bar_Panel {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
22
		function init() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
			$this->title( 'Freemius' );
24
		}
25
26
		static function requests_count() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
27
			if ( class_exists( 'Freemius_Api_WordPress' ) ) {
28
				$logger = Freemius_Api_WordPress::GetLogger();
29
			} else {
30
				$logger = array();
31
			}
32
33
			return number_format( count( $logger ) );
34
		}
35
36
		static function total_time() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
37
			if ( class_exists( 'Freemius_Api_WordPress' ) ) {
38
				$logger = Freemius_Api_WordPress::GetLogger();
39
			} else {
40
				$logger = array();
41
			}
42
43
			$total_time = .0;
44
			foreach ( $logger as $l ) {
45
				$total_time += $l['total'];
46
			}
47
48
			return number_format( 100 * $total_time, 2 ) . ' ' . fs_text_x_inline( 'ms', 'milliseconds' );
49
		}
50
51
		function render() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
52
			?>
53
			<div id='debug-bar-php'>
54
				<?php fs_require_template( '/debug/api-calls.php' ) ?>
55
				<br>
56
				<?php fs_require_template( '/debug/scheduled-crons.php' ) ?>
57
				<br>
58
				<?php fs_require_template( '/debug/plugins-themes-sync.php' ) ?>
59
				<br>
60
				<?php fs_require_template( '/debug/logger.php' ) ?>
61
			</div>
62
		<?php
63
		}
64
	}
65