felixarntz/wp-site-identity

View on GitHub

Showing 71 of 247 total issues

Method set_default_args_for_setting has 47 lines of code (exceeds 25 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':

    Function render_number_control has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function render_number_control( $value, WP_Site_Identity_Settings_Field $field ) {
            $attrs = $this->make_base_attrs( $field, array(
                'check_description' => true,
            ) );
            $props = $this->make_base_props( $field );

    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 get_url_to_admin_page has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function get_url_to_admin_page( WP_Site_Identity_Admin_Page $admin_page ) {
            $slug = $admin_page->get_slug();
    
            $query_args = array();
    
    

    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_init has a Cognitive Complexity of 14 (exceeds 5 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 ) {
    Severity: Minor
    Found in src/class-wp-site-identity-bootstrap-shortcodes.php - About 1 hr to fix

    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 format_address has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function format_address( $format, array $placeholders, array $placeholder_values ) {
            $formatted = str_replace( $placeholders, $placeholder_values, $format );
    
            $formatted_parts = array();
    
    
    Severity: Minor
    Found in src/class-wp-site-identity-owner-data.php - About 1 hr to fix

      Method get_owner_data_sections has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get_owner_data_sections() {
              $sections = array(
                  'basic'   => array(
                      'slug'   => 'basic',
                      'title'  => __( 'Basic Information', 'wp-site-identity' ),
      Severity: Minor
      Found in src/class-wp-site-identity-bootstrap.php - About 1 hr to fix

        Function validate_string_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function validate_string_value( $value, $args ) {
                $value = trim( (string) $value );
        
                if ( ! empty( $args['enum'] ) && ! in_array( $value, $args['enum'], true ) ) {
                    /* translators: 1: value, 2: list of valid values */
        Severity: Minor
        Found in src/settings/class-wp-site-identity-setting-validator.php - About 1 hr to fix

        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 get has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function get( $id ) {
                if ( ! isset( $this->instances[ $id ] ) ) {
                    if ( ! isset( $this->definitions[ $id ] ) ) {
                        /* translators: %s: service identifier */
                        throw new WP_Site_Identity_Service_Not_Found_Exception( sprintf( __( 'The service with the identifier %s could not be found.', 'wp-site-identity' ), $id ) );
        Severity: Minor
        Found in src/class-wp-site-identity-service-container.php - About 1 hr to fix

        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 openImageMediaModal has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function openImageMediaModal() {
                var field        = document.getElementById( this.dataset.target );
                var preview      = document.getElementById( this.dataset.target + '-preview' );
                var selectButton = this;
                var deleteButton = document.getElementById( this.dataset.target + '-delete-button' );
        Severity: Minor
        Found in assets/src/js/settings-page.js - About 1 hr to fix

          Function openImageMediaModal has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function openImageMediaModal() {
                  var field        = document.getElementById( this.dataset.target );
                  var preview      = document.getElementById( this.dataset.target + '-preview' );
                  var selectButton = this;
                  var deleteButton = document.getElementById( this.dataset.target + '-delete-button' );
          Severity: Minor
          Found in assets/dist/js/settings-page.js - About 1 hr to fix

            Method render_site_identity_data_widget has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function render_site_identity_data_widget( $instance ) {
                    $owner_data = $this->plugin->owner_data();
            
                    $output = '';
            
            
            Severity: Minor
            Found in src/class-wp-site-identity-bootstrap-widgets.php - About 1 hr to fix

              Function set_default_default_for_type has a Cognitive Complexity of 12 (exceeds 5 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 ) {
              Severity: Minor
              Found in src/settings/class-wp-site-identity-setting-factory.php - About 1 hr to fix

              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 add_owner_data_content has a Cognitive Complexity of 12 (exceeds 5 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';
              
              
              Severity: Minor
              Found in src/class-wp-site-identity-bootstrap-customizer.php - About 1 hr to fix

              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 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct( WP_Site_Identity_Setting $setting, array $args = array(), WP_Site_Identity_Settings_Field_Registry $registry = null ) {
                      $this->slug    = $setting->get_name();
                      $this->setting = $setting;
              
                      if ( ! empty( $args['title'] ) ) {

                Method render_number_control has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function render_number_control( $value, WP_Site_Identity_Settings_Field $field ) {
                        $attrs = $this->make_base_attrs( $field, array(
                            'check_description' => true,
                        ) );
                        $props = $this->make_base_props( $field );

                  Function add_brand_data_content has a Cognitive Complexity of 11 (exceeds 5 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';
                  
                  
                  Severity: Minor
                  Found in src/class-wp-site-identity-bootstrap-customizer.php - About 1 hr to fix

                  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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function validate( $data ) {
                          if ( $data instanceof stdClass ) {
                              $data = (array) $data;
                          }
                  
                  
                  Severity: Minor
                  Found in src/settings/class-wp-site-identity-aggregate-setting.php - About 1 hr to fix

                  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 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __construct( WP_Site_Identity_Setting $setting, array $args = array(), WP_Site_Identity_Settings_Field_Registry $registry = null ) {
                          $this->slug    = $setting->get_name();
                          $this->setting = $setting;
                  
                          if ( ! empty( $args['title'] ) ) {

                  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 get has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function get( $name ) {
                          switch ( $name ) {
                              case 'primary_shade_color':
                              case 'secondary_shade_color':
                              case 'tertiary_shade_color':
                  Severity: Minor
                  Found in src/class-wp-site-identity-brand-data.php - About 1 hr to fix

                    Method validate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function validate( $data ) {
                            if ( $data instanceof stdClass ) {
                                $data = (array) $data;
                            }
                    
                    
                    Severity: Minor
                    Found in src/settings/class-wp-site-identity-aggregate-setting.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language