rousnay /
lighthouse
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
|
0 ignored issues
–
show
|
|||
| 2 | |||
| 3 | /* |
||
| 4 | * Register All Menus |
||
| 5 | * |
||
| 6 | */ |
||
| 7 | function lighthouse_menus() {
|
||
| 8 | register_nav_menus( |
||
| 9 | array( |
||
| 10 | 'header-menu-left' => __( 'Header menu left', 'nav menu location', 'lighthouse' ), |
||
| 11 | 'header-menu-right' => __( 'Header menu right' , 'nav menu location', 'lighthouse'), |
||
| 12 | 'footer-menu' => __( 'Footer menu' , 'nav menu location', 'lighthouse'), |
||
| 13 | 'footer-menu-bottom' => __( 'Footer menu bottom' , 'nav menu location', 'lighthouse') |
||
| 14 | ) |
||
| 15 | ); |
||
| 16 | } |
||
| 17 | |||
| 18 | add_action( 'init', 'lighthouse_menus' ); |
||
| 19 | |||
| 20 | |||
| 21 | /* |
||
| 22 | * Menus Settings |
||
| 23 | * |
||
| 24 | */ |
||
| 25 | |||
| 26 | //Left menu |
||
| 27 | View Code Duplication | function lighthouse_header_menu_left() {
|
|
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 28 | if ( has_nav_menu( 'header-menu-left' ) ) {
|
||
| 29 | wp_nav_menu( |
||
| 30 | array( |
||
| 31 | 'theme_location' => 'header-menu-left', |
||
| 32 | 'menu' => '', |
||
| 33 | 'container' => 'div', |
||
| 34 | 'container_id' => 'header-menu-left-id', |
||
| 35 | 'container_class' => 'header-menu-left-cl', |
||
| 36 | 'menu_id' => 'header-menu-id', |
||
| 37 | 'menu_class' => 'header-menu-cl', |
||
| 38 | 'echo' => true, |
||
| 39 | 'fallback_cb' => '', |
||
| 40 | 'before' => '', |
||
| 41 | 'after' => '', |
||
| 42 | 'link_before' => '<span>', |
||
| 43 | 'link_after' => '</span>', |
||
| 44 | 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
||
| 45 | 'depth' => 0, |
||
| 46 | 'walker' => '' |
||
| 47 | ) |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | //Right menu |
||
| 53 | View Code Duplication | function lighthouse_header_menu_right() {
|
|
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 54 | if ( has_nav_menu( 'header-menu-right' ) ) {
|
||
| 55 | wp_nav_menu( |
||
| 56 | array( |
||
| 57 | 'theme_location' => 'header-menu-right', |
||
| 58 | 'menu' => '', |
||
| 59 | 'container' => 'div', |
||
| 60 | 'container_id' => 'header-menu-right-id', |
||
| 61 | 'container_class' => 'header-menu-right-cl', |
||
| 62 | 'menu_id' => 'header-menu-id', |
||
| 63 | 'menu_class' => 'header-menu-cl', |
||
| 64 | 'echo' => true, |
||
| 65 | 'fallback_cb' => '', |
||
| 66 | 'before' => '', |
||
| 67 | 'after' => '', |
||
| 68 | 'link_before' => '<span>', |
||
| 69 | 'link_after' => '</span>', |
||
| 70 | 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
||
| 71 | 'depth' => 0, |
||
| 72 | 'walker' => '' |
||
| 73 | ) |
||
| 74 | ); |
||
| 75 | } |
||
| 76 | } |
||
| 77 | |||
| 78 | //Fotter menu |
||
| 79 | View Code Duplication | function lighthouse_footer_menu() {
|
|
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 80 | if ( has_nav_menu( 'footer-menu' ) ) {
|
||
| 81 | wp_nav_menu( |
||
| 82 | array( |
||
| 83 | 'theme_location' => 'footer-menu', |
||
| 84 | 'menu' => '', |
||
| 85 | 'container' => 'div', |
||
| 86 | 'container_id' => 'footer-menu-id', |
||
| 87 | 'container_class' => 'footer-menu-cl', |
||
| 88 | 'menu_id' => 'footer-menu-id', |
||
| 89 | 'menu_class' => 'footer-menu-cl', |
||
| 90 | 'echo' => true, |
||
| 91 | 'fallback_cb' => '', |
||
| 92 | 'before' => '', |
||
| 93 | 'after' => '', |
||
| 94 | 'link_before' => '', |
||
| 95 | 'link_after' => '', |
||
| 96 | 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
||
| 97 | 'depth' => 0, |
||
| 98 | 'walker' => '' |
||
| 99 | ) |
||
| 100 | ); |
||
| 101 | } |
||
| 102 | } |
||
| 103 | |||
| 104 | //Menu footer-bottom |
||
| 105 | View Code Duplication | function lighthouse_footer_menu_bottom() {
|
|
|
0 ignored issues
–
show
This function seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. Loading history...
|
|||
| 106 | if ( has_nav_menu( 'footer-menu-bottom' ) ) {
|
||
| 107 | wp_nav_menu( |
||
| 108 | array( |
||
| 109 | 'theme_location' => 'footer-menu-bottom', |
||
| 110 | 'menu' => '', |
||
| 111 | 'container' => 'div', |
||
| 112 | 'container_id' => 'footer-menu-bottom-id', |
||
| 113 | 'container_class' => 'footer-menu-bottom-cl', |
||
| 114 | 'menu_id' => 'footer-menu-id', |
||
| 115 | 'menu_class' => 'footer-menu-cl', |
||
| 116 | 'echo' => true, |
||
| 117 | 'fallback_cb' => '', |
||
| 118 | 'before' => '', |
||
| 119 | 'after' => '', |
||
| 120 | 'link_before' => '', |
||
| 121 | 'link_after' => '', |
||
| 122 | 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>', |
||
| 123 | 'depth' => 0, |
||
| 124 | 'walker' => '' |
||
| 125 | ) |
||
| 126 | ); |
||
| 127 | } |
||
| 128 | } |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.