Showing 71 of 247 total issues
Method action_render_settings_page
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function action_render_settings_page( $admin_page ) {
if ( ! is_a( $admin_page, 'WP_Site_Identity_Admin_Submenu_Page' ) || 'options-general.php' !== $admin_page->get_parent_slug() ) {
require ABSPATH . 'wp-admin/options-head.php';
}
Method set_default_default_for_type
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function set_default_default_for_type( array $args ) {
$type = isset( $args['type'] ) ? $args['type'] : '';
$min = isset( $args['min'] ) ? $args['min'] : false;
switch ( $type ) {
Method build_rest_schema_for_wp
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function build_rest_schema_for_wp( WP_Site_Identity_Setting $setting ) {
$default_schema = array(
'type' => $setting->get_type(),
'description' => $setting->get_description(),
'default' => $setting->get_default(),
Function initializeImageField
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeImageField( field ) {
var selectButton = document.createElement( 'button' );
var deleteButton = document.createElement( 'button' );
var value = parseInt( field.value, 10 );
var attachment = document.getElementById( field.id + '-attachment-data' );
Function initializeImageField
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initializeImageField( field ) {
var selectButton = document.createElement( 'button' );
var deleteButton = document.createElement( 'button' );
var value = parseInt( field.value, 10 );
var attachment = document.getElementById( field.id + '-attachment-data' );
Method wpsi_requirements_notice
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpsi_requirements_notice() {
$plugin_file = plugin_basename( __FILE__ );
// WordPress before 4.9 didn't have a dedicated capability for this.
if ( version_compare( $GLOBALS['wp_version'], '4.9', '<' ) ) {
Method get_as_html
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_as_html( $name ) {
switch ( $name ) {
case 'phone_link':
case 'email_link':
case 'website_link':
Function validate_numeric_value
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function validate_numeric_value( $value, $args ) {
if ( ! is_numeric( $value ) ) {
/* translators: 1: value, 2: type name */
throw new WP_Site_Identity_Setting_Validation_Error_Exception( sprintf( __( '%1$s is not of type %2$s.', 'wp-site-identity' ), $value, $args['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 action_handle_settings_page
has a Cognitive Complexity of 10 (exceeds 5 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();
- 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 action_enqueue_settings_page
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function action_enqueue_settings_page() {
$dependencies = array();
$l10n = array();
$min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
Function get_theme_support
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function get_theme_support( $feature ) {
$support = get_theme_support( 'wp_site_identity' );
if ( ! $support ) {
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
Function __construct
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $slug, array $args = array(), WP_Site_Identity_Admin_Page_Registry $registry = null ) {
$this->slug = $slug;
if ( ! empty( $args['title'] ) ) {
$this->title = $args['title'];
- 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 build_rest_schema_for_wp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function build_rest_schema_for_wp( WP_Site_Identity_Setting $setting ) {
$default_schema = array(
'type' => $setting->get_type(),
'description' => $setting->get_description(),
'default' => $setting->get_default(),
- 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 action_render_settings_page
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function action_render_settings_page( $admin_page ) {
if ( ! is_a( $admin_page, 'WP_Site_Identity_Admin_Submenu_Page' ) || 'options-general.php' !== $admin_page->get_parent_slug() ) {
require ABSPATH . 'wp-admin/options-head.php';
}
- 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 attrs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function attrs( array $attrs ) {
foreach ( $attrs as $attr => $value ) {
if ( is_array( $value ) || is_object( $value ) ) {
$value = wp_json_encode( $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
Function validate_object_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function validate_object_value( $value, $args ) {
if ( $value instanceof stdClass ) {
$value = (array) $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
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct( $id_base, $name, $description, $render_callback, array $fields = array(), WP_Site_Identity_Widget_Registry $registry = null ) {
Function generate_schema_for_setting
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function generate_schema_for_setting( $setting ) {
$base_schema = array(
'type' => $setting->get_type(),
'description' => $setting->get_description(),
'default' => $setting->get_default(),
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct( $prefix, $group, WP_Site_Identity_Setting_Feedback_Handler $feedback_handler = null, WP_Site_Identity_Setting_Validator $validator = null, WP_Site_Identity_Setting_Sanitizer $sanitizer = null ) {
Method create_widget
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function create_widget( $id_base, $name, $description, $render_callback, array $fields = array() ) {