Showing 71 of 247 total issues
Method action_init
has 179 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function action_init() {
$registry = $this->plugin->services()->get( 'setting_registry' );
$factory = $registry->factory();
$type_choices = $this->bootstrap->get_type_choices();
File class-wp-site-identity-bootstrap-customizer.php
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WP_Site_Identity_Bootstrap_Customizer class
*
* @package WPSiteIdentity
Function format_address
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
protected function format_address( $format, array $placeholders, array $placeholder_values ) {
$formatted = str_replace( $placeholders, $placeholder_values, $format );
$formatted_parts = array();
- 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 update
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
foreach ( $this->fields as $attr => $field ) {
switch ( $field['type'] ) {
- 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 set_default_control_args_for_setting
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private function set_default_control_args_for_setting( array $control_args, WP_Site_Identity_Setting $setting ) {
$type = $setting->get_type();
switch ( $type ) {
case 'boolean':
- 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 add_owner_data_content
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function add_owner_data_content( $wp_customize, $setting_registry, $panel_slug ) {
$registry = $setting_registry->get_setting( 'owner_data' );
$data = $this->plugin->owner_data();
$section_slug = 'owner_data';
Function form
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, $this->get_defaults() );
foreach ( $this->fields as $attr => $field ) {
$meta = $this->attrs( $field['meta'] );
- 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 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function form( $instance ) {
$instance = wp_parse_args( (array) $instance, $this->get_defaults() );
foreach ( $this->fields as $attr => $field ) {
$meta = $this->attrs( $field['meta'] );
Function set_default_args_for_setting
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected function set_default_args_for_setting( array $args, WP_Site_Identity_Setting $setting ) {
$type = isset( $args['type'] ) ? $args['type'] : $setting->get_type();
switch ( $type ) {
case 'boolean':
- 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 add_brand_data_content
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function add_brand_data_content( $wp_customize, $setting_registry, $panel_slug ) {
$registry = $setting_registry->get_setting( 'brand_data' );
$data = $this->plugin->brand_data();
$section_slug = 'brand_data';
WP_Site_Identity_Settings_Field
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class WP_Site_Identity_Settings_Field {
/**
* Slug of the settings field.
*
Function render_site_identity_data_widget
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function render_site_identity_data_widget( $instance ) {
$owner_data = $this->plugin->owner_data();
$output = '';
- 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 set_default_control_args_for_setting
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function set_default_control_args_for_setting( array $control_args, WP_Site_Identity_Setting $setting ) {
$type = $setting->get_type();
switch ( $type ) {
case 'boolean':
Method wpsi_load
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpsi_load() {
$classes_dir = plugin_dir_path( __FILE__ ) . 'src/';
// Main.
require_once $classes_dir . 'class-wp-site-identity.php';
Method update
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function update( $new_instance, $old_instance ) {
$instance = $old_instance;
foreach ( $this->fields as $attr => $field ) {
switch ( $field['type'] ) {
Method action_init
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function action_init() {
$registry = $this->plugin->services()->get( 'shortcode_registry' );
$factory = $registry->factory();
foreach ( $this->plugin->services()->get( 'setting_registry' )->get_all_settings() as $aggregate_setting ) {
File class-wp-site-identity-settings-field-control-callbacks.php
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WP_Site_Identity_Settings_Field_Control_Callbacks class
*
* @package WPSiteIdentity
Function attrs
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function attrs( $attrs ) {
$output = '';
foreach ( $attrs as $attr => $value ) {
if ( is_bool( $value ) ) {
- 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
File class-wp-site-identity-widget.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WP_Site_Identity_Widget class
*
* @package WPSiteIdentity
Method action_handle_settings_page
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function action_handle_settings_page() {
$setting_registry = $this->plugin->services()->get( 'setting_registry' );
$factory = $this->plugin->services()->get( 'settings_form_registry' )->factory();