Function getSidebar
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
protected function getSidebar( $options = [] ) {
// Force the rendering of the following portals
$sidebar = $this->data['sidebar'];
if ( !isset( $sidebar['SEARCH'] ) ) {
// @phan-suppress-next-line PhanTypeMismatchDimAssignment False positive
- 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 getSidebar
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getSidebar( $options = [] ) {
// Force the rendering of the following portals
$sidebar = $this->data['sidebar'];
if ( !isset( $sidebar['SEARCH'] ) ) {
// @phan-suppress-next-line PhanTypeMismatchDimAssignment False positive
Method getFooter
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFooter( $iconStyle = 'icononly', $linkStyle = 'flat' ) {
$validFooterIcons = $this->get( 'footericons' );
if ( $iconStyle === 'icononly' ) {
$this->unsetIconsWithoutImages( $validFooterIcons );
} else {
Function getFooter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getFooter( $iconStyle = 'icononly', $linkStyle = 'flat' ) {
$validFooterIcons = $this->get( 'footericons' );
if ( $iconStyle === 'icononly' ) {
$this->unsetIconsWithoutImages( $validFooterIcons );
} else {
- 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 getFooterLinks
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getFooterLinks( $option = null ) {
$footerlinks = $this->get( 'footerlinks' );
// Reduce footer links down to only those which are being used
$validFooterLinks = [];
- 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 unsetIconsWithoutImages
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function unsetIconsWithoutImages( array &$icons ) {
// Unset any icons which don't have an image
foreach ( $icons as $iconsKey => &$iconsBlock ) {
foreach ( $iconsBlock as $iconKey => $icon ) {
if ( !is_string( $icon ) && !isset( $icon['src'] ) ) {
- 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"