File class.administrationpage.php
has 684 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @package toolkit
*/
Function appendNavigation
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public function appendNavigation()
{
$nav = $this->getNavigationArray();
/**
- 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
AdministrationPage
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class AdministrationPage extends HTMLPage
{
/**
* An array of `Alert` objects used to display page level
* messages to Symphony backend users one by one. Prior to Symphony 2.3
Method build
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build(array $context = [])
{
parent::build($context);
if (!$this->canAccessPage()) {
Function canAccessPage
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function canAccessPage()
{
$nav = $this->getNavigationArray();
$page = '/' . trim(getCurrentPage(), '/') . '/';
- 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 buildExtensionsNavigation
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
private function buildExtensionsNavigation(&$nav)
{
// Loop over all the installed extensions to add in other navigation items
$extensions = Symphony::ExtensionManager()->listInstalledHandles();
- 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 appendNavigation
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function appendNavigation()
{
$nav = $this->getNavigationArray();
/**
Function buildXmlNavigation
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function buildXmlNavigation(&$nav)
{
$xml = simplexml_load_file(ASSETS . '/xml/navigation.xml');
// Loop over the default Symphony navigation file, converting
- 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 canAccessPage
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function canAccessPage()
{
$nav = $this->getNavigationArray();
$page = '/' . trim(getCurrentPage(), '/') . '/';
Method buildExtensionsNavigation
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildExtensionsNavigation(&$nav)
{
// Loop over all the installed extensions to add in other navigation items
$extensions = Symphony::ExtensionManager()->listInstalledHandles();
Method buildSectionNavigation
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildSectionNavigation(&$nav)
{
// Build the section navigation, grouped by their navigation groups
$sections = (new SectionManager)->select()->sort('sortorder')->execute()->rows();
Function __findActiveNavigationGroup
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function __findActiveNavigationGroup(array &$nav, $pageroot, $pattern = false)
{
foreach ($nav as $index => $contents) {
if (is_array($contents['children']) && !empty($contents['children'])) {
foreach ($contents['children'] as $item) {
- 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 addTimestampValidationPageAlert
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function addTimestampValidationPageAlert($errorMessage, $existingObject, $action)
{
$authorId = $existingObject->get('modification_author_id');
if (!$authorId) {
$authorId = $existingObject->get('author_id');
Method buildXmlNavigation
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildXmlNavigation(&$nav)
{
$xml = simplexml_load_file(ASSETS . '/xml/navigation.xml');
// Loop over the default Symphony navigation file, converting
Function build
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function build(array $context = [])
{
parent::build($context);
if (!$this->canAccessPage()) {
- 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 doesAuthorHaveAccess
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function doesAuthorHaveAccess($item_limit = null)
{
$can_access = false;
if (!isset($item_limit) || $item_limit === 'author') {
- 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
Consider simplifying this complex logical expression. Open
if (!isset($item_limit) || $item_limit === 'author') {
$can_access = true;
} elseif ($item_limit === 'developer' && Symphony::Author()->isDeveloper()) {
$can_access = true;
} elseif ($item_limit === 'manager' && (Symphony::Author()->isManager() || Symphony::Author()->isDeveloper())) {
Function appendBodyAttributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function appendBodyAttributes(array $context = array())
{
foreach ($context as $key => $value) {
if (is_numeric($value)) {
$key = 'id';
- 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 __switchboard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __switchboard($type = 'view')
{
if (!isset($this->_context['action']) || trim($this->_context['action']) === '') {
$action = 'index';
} 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"