Showing 56 of 56 total issues
File Backend.php
has 1398 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Toplytics;
use Exception;
Function convertDataToPosts
has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring. Open
private function convertDataToPosts($data, $when)
{
$new_data = [];
if ($this->checkSetting('ignore_posts_ids')) {
- 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
Backend
has 62 functions (exceeds 20 allowed). Consider refactoring. Open
class Backend
{
/**
* The ID of this plugin.
Method initSettings
has 214 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function initSettings()
{
$options = get_option('toplytics_settings');
if ($options == false) {
$options = $this->getDefaultSettings();
Method widget
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function widget($args, $instance)
{
ob_start();
Function widget
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function widget($args, $instance)
{
ob_start();
- 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
Method form
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function form($instance)
{
$widget_title = isset($instance['title']) ? esc_attr($instance['title']) : '';
if (!isset($instance['numberposts']) || !$widget_numberposts = (int) $instance['numberposts']) {
Method convertDataToPosts
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function convertDataToPosts($data, $when)
{
$new_data = [];
if ($this->checkSetting('ignore_posts_ids')) {
Function update_additional_posts_data
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function update_additional_posts_data()
{
// Fetch the widgets data from the database, if not already retrieved.
$this->_maybe_fetch_widgets_data();
- 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
Method getAnalyticsData
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getAnalyticsData( $extended_fetch = false )
{
$propertyId = get_option('toplytics_property_id', false);
if (!$propertyId) return false;
Method update_additional_posts_data
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update_additional_posts_data()
{
// Fetch the widgets data from the database, if not already retrieved.
$this->_maybe_fetch_widgets_data();
Function _have_enough_results
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private function _have_enough_results( $posts, $period )
{
// Fetch the widgets data from the database, if not already retrieved.
$this->_maybe_fetch_widgets_data();
- 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 printInput
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function printInput($args)
{
$option = 'toplytics_settings';
$settings = get_option($option);
- 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 getAnalyticsData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function getAnalyticsData( $extended_fetch = false )
{
$propertyId = get_option('toplytics_property_id', false);
if (!$propertyId) return false;
- 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
Method privateAuthorization
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function privateAuthorization()
{
if (empty($_POST['ToplyticsSubmitPrivateAuthorization'])) {
return false;
}
Function showTheTop
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function showTheTop($args)
{
$args = $this->validateArgs($args);
// Parse category argument as integer, if present in the shortcode.
$category = ( ! empty( $args['category'] ) ) ? intval( $args['category'] ) : 0;
- 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 updateAnalyticsDataResults
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function updateAnalyticsDataResults( $extended_fetch = false )
{
try {
$data = $this->getAnalyticsData( $extended_fetch );
} catch (Exception $e) {
- 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 openWindowToSettingsView
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function openWindowToSettingsView()
{
if (get_option('toplytics_google_token')) {
$profile = get_option('toplytics_profile_data');
- 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 serviceConnect
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function serviceConnect()
{
if (!$this->client) {
return false;
}
- 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
Method serviceDisconnect
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function serviceDisconnect($programatic = false, $silent = false)
{
if (empty($_POST['ToplyticsSubmitAccountDisconnect']) && !$programatic) {
return;
}