soderlind/plugin-customizer

View on GitHub
src/Plugin_Customizer.php

Summary

Maintainability
B
4 hrs
Test Coverage

Plugin_Customizer has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

    abstract class Plugin_Customizer implements Plugin_Customizer_Interface {

        private  $customize_register_priority = 9; // Priority must be between 2 and 9
        private  $slug;
        private  $org_theme;
Severity: Minor
Found in src/Plugin_Customizer.php - About 2 hrs to fix

    Method init has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function init( $config = array() ) {
    
                if ( ! count( $config ) ) {
                    wp_die( /*$message = '', $title = '', $args = array()*/ );
                }
    Severity: Minor
    Found in src/Plugin_Customizer.php - About 1 hr to fix

      Found precision alignment of 1 spaces.
      Open

                   $new_rules = array(
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               * @param   Array    $query_vars All defined query variables.
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Expected 1 space before opening brace; found 0
      Open

                      add_filter( 'pre_option_template', function(){
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Assignments must be the first block of code on a line
      Open

                  if ( $overridden_template = locate_template( "plugin-customizer/{$template}" ) ) {
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               *    2) [parent-theme]/plugin-customizer/
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               * @param   string    $template plugin_root to the template
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
      Open

                  $version = PLUGIN_CUSTOMIZER_VERSION;
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Found precision alignment of 2 spaces.
      Open

                        sprintf( '%s/templates/(.*)$', $this->slug ) => sprintf( 'index.php?plugin-customizer-template-%s=%s', $this->slug, $wp_rewrite->preg_index( 1 ) ),
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Found precision alignment of 1 spaces.
      Open

                   );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
      Open

                  $this->root = plugin_dir_path( __FILE__ );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               *    1) [child-theme]/plugin-customizer/
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               * @param   Object    $wp_rewrite Permalink structure
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Found precision alignment of 1 spaces.
      Open

                   $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Equals sign not aligned with surrounding assignments; expected 7 spaces but found 1 space
      Open

                  $src = $this->url . 'assets/js/plugin-customizer-preview-templates.js';
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Expected exactly one space before closing parenthesis; " " found.
      Open

              public function switch_template_uri( $uri  ) {
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Please spell "WordPress" correctly. Found 1 misspelling(s): WordPres
      Open

                   * WordPres Customizer is dependant on functionality in the theme. Just in case
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               * @return  Array                 Rewrite rules
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               * @return  Array                The updated array with query variables.
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Spaces must be used for mid-line alignment; tabs are not allowed
      Open

               *    3) [plugin directory]/templates/
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Equals sign not aligned with surrounding assignments; expected 6 spaces but found 1 space
      Open

                  $deps = array( 'customize-controls' );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Space found before comma in function call
      Open

                  $url = add_query_arg( $this->slug , 'on', $url );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Array item not aligned correctly; expected 17 spaces but found 18
      Open

                        sprintf( '%s/templates/(.*)$', $this->slug ) => sprintf( 'index.php?plugin-customizer-template-%s=%s', $this->slug, $wp_rewrite->preg_index( 1 ) ),
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Space found before comma in function call
      Open

                  $this->slug = sanitize_title( $config['name'] , 'plugin-customizer' );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Equals sign not aligned with surrounding assignments; expected 9 spaces but found 2 spaces
      Open

                  $this->url  = plugins_url( '/', __FILE__ );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
      Open

                  $this->slug = sanitize_title( $config['name'] , 'plugin-customizer' );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Expected 1 space before opening brace; found 0
      Open

                  add_filter( 'pre_option_blogname', function(){
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Expected 1 space before opening brace; found 0
      Open

                      add_filter( 'pre_option_stylesheet', function(){
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Space found before comma in function call
      Open

                  wp_enqueue_script( $this->slug, $src, $deps, $version , $in_footer );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Equals sign not aligned with surrounding assignments; expected 5 spaces but found 1 space
      Open

                  $template = basename( $template, '.php' );
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      Found precision alignment of 1 spaces.
      Open

                   return $wp_rewrite->rules;
      Severity: Minor
      Found in src/Plugin_Customizer.php by phpcodesniffer

      There are no issues that match your filters.

      Category
      Status