core/model/modx/processors/system/actionlist.inc.php
Function getAction
has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring. Open
Open
function getAction($lastaction, $itemid='') {
switch($lastaction) {
case "1" : return "Loading a frame(set)"; break;
case "2" : return "Viewing home page/ online users"; break;
case "3" : return "Viewing data for document $itemid"; break;
- 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 getAction
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getAction($lastaction, $itemid='') {
switch($lastaction) {
case "1" : return "Loading a frame(set)"; break;
case "2" : return "Viewing home page/ online users"; break;
case "3" : return "Viewing data for document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "57" : return "Refresh menu"; break;
Avoid too many return
statements within this method. Open
Open
case "70" : return "Viewing site schedule"; break;
Avoid too many return
statements within this method. Open
Open
case "90" : return "Deleting web user $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "100" : return "Previewing document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "102" : return "Edit plugin $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "115" : return "View event log details $itemid"; break;
Avoid too many return
statements within this method. Open
Open
default : return "Idle";
Avoid too many return
statements within this method. Open
Open
case "6" : return "Deleting document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "12" : return "Editing user $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "15" : return "Saving a parser"; break;
Avoid too many return
statements within this method. Open
Open
case "16" : return "Editing template $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "22" : return "Editing Snippet $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "24" : return "Saving Snippet $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "36" : return "Saving role $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "63" : return "Un-deleting a document"; break;
Avoid too many return
statements within this method. Open
Open
case "69" : return "Viewing online visitors"; break;
Avoid too many return
statements within this method. Open
Open
case "84" : return "Load Resource Selector"; break;
Avoid too many return
statements within this method. Open
Open
case "92" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "999" : return "Viewing test page"; break;
Avoid too many return
statements within this method. Open
Open
case "9" : return "Viewing help"; break;
Avoid too many return
statements within this method. Open
Open
case "88" : return "Editing web user $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "97" : return "Duplicate Chunk (HTML Snippet) $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "114" : return "View event log"; break;
Avoid too many return
statements within this method. Open
Open
case "26" : return "Refreshing site"; break;
Avoid too many return
statements within this method. Open
Open
case "61" : return "Publishing a document"; break;
Avoid too many return
statements within this method. Open
Open
case "66" : return "Sending a message"; break;
Avoid too many return
statements within this method. Open
Open
case "78" : return "Editing Chunk (HTML Snippet) $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "93" : return "Backup Manager"; break;
Avoid too many return
statements within this method. Open
Open
case "116" : return "Delete event log $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "53" : return "Viewing system info"; break;
Avoid too many return
statements within this method. Open
Open
case "54" : return "Optimizing a table"; break;
Avoid too many return
statements within this method. Open
Open
case "55" : return "Empty logs"; break;
Avoid too many return
statements within this method. Open
Open
case "60" : return "Emptying Recycle Bin"; break;
Avoid too many return
statements within this method. Open
Open
case "64" : return "Removing deleted content"; break;
Avoid too many return
statements within this method. Open
Open
case "72" : return "Adding a weblink"; break;
Avoid too many return
statements within this method. Open
Open
case "73" : return "Editing a weblink"; break;
Avoid too many return
statements within this method. Open
Open
case "101" : return "Create new plugin $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "11" : return "Creating a user"; break;
Avoid too many return
statements within this method. Open
Open
case "19" : return "Creating a new template"; break;
Avoid too many return
statements within this method. Open
Open
case "23" : return "Creating a new Snippet"; break;
Avoid too many return
statements within this method. Open
Open
case "37" : return "Deleting role $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "41" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "80" : return "Deleting Chunk (HTML Snippet) $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "89" : return "Saving web user $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "95" : return "Importing documents from HTML"; break;
Avoid too many return
statements within this method. Open
Open
case "56" : return "Refresh document tree"; break;
Avoid too many return
statements within this method. Open
Open
case "68" : return "Viewing site logging"; break;
Avoid too many return
statements within this method. Open
Open
case "76" : return "Resource management"; break;
Avoid too many return
statements within this method. Open
Open
case "103" : return "Saving plugin $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "300" : return "Create Template Variable"; break;
Avoid too many return
statements within this method. Open
Open
case "303" : return "Delete Template Variable"; break;
Avoid too many return
statements within this method. Open
Open
case "8" : return "Logged out"; break;
Avoid too many return
statements within this method. Open
Open
case "20" : return "Saving template $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "25" : return "Deleting Snippet $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "38" : return "Creating new role"; break;
Avoid too many return
statements within this method. Open
Open
case "47" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "50" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "67" : return "Removing locks"; break;
Avoid too many return
statements within this method. Open
Open
case "86" : return "Role management"; break;
Avoid too many return
statements within this method. Open
Open
case "18" : return "Viewing Credits :)"; break;
Avoid too many return
statements within this method. Open
Open
case "34" : return "Saving new password"; break;
Avoid too many return
statements within this method. Open
Open
case "48" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "49" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "91" : return "Editing Web Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "96" : return "Duplicate Template $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "105" : return "Duplicate plugin $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "5" : return "Saving document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "10" : return "Viewing/ composing messages"; break;
Avoid too many return
statements within this method. Open
Open
case "21" : return "Deleting template $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "32" : return "Saving user $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "42" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "45" : return "Idle"; break;
Avoid too many return
statements within this method. Open
Open
case "71" : return "Searching"; break;
Avoid too many return
statements within this method. Open
Open
case "85" : return "Create Folder"; break;
Avoid too many return
statements within this method. Open
Open
case "302" : return "Save Template Variable"; break;
Avoid too many return
statements within this method. Open
Open
case "31" : return "Using file manager"; break;
Avoid too many return
statements within this method. Open
Open
case "35" : return "Editing role $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "59" : return "About MODX"; break;
Avoid too many return
statements within this method. Open
Open
case "62" : return "Un-publishing a document"; break;
Avoid too many return
statements within this method. Open
Open
case "77" : return "Creating a new Chunk (HTML Snippet)"; break;
Avoid too many return
statements within this method. Open
Open
case "79" : return "Saving Chunk (HTML Snippet) $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "99" : return "Manage Web Users"; break;
Avoid too many return
statements within this method. Open
Open
case "301" : return "Edit Template Variable"; break;
Avoid too many return
statements within this method. Open
Open
case "200" : return "Viewing phpInfo()"; break;
Avoid too many return
statements within this method. Open
Open
case "14" : return "Editing a parser"; break;
Avoid too many return
statements within this method. Open
Open
case "27" : return "Editing document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "17" : return "Editing settings"; break;
Avoid too many return
statements within this method. Open
Open
case "43" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "75" : return "User/ role management"; break;
Avoid too many return
statements within this method. Open
Open
case "94" : return "Duplicate Document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "104" : return "Delete plugin $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "28" : return "Changing password"; break;
Avoid too many return
statements within this method. Open
Open
case "7" : return "Waiting while MODX cleans up"; break;
Avoid too many return
statements within this method. Open
Open
case "58" : return "Logged in"; break;
Avoid too many return
statements within this method. Open
Open
case "13" : return "Viewing logging"; break;
Avoid too many return
statements within this method. Open
Open
case "83" : return "Exporting a document to HTML"; break;
Avoid too many return
statements within this method. Open
Open
case "29" : return "Error"; break;
Avoid too many return
statements within this method. Open
Open
case "33" : return "Deleting user $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "44" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "46" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "51" : return "Moving document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "52" : return "Moved document $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "87" : return "Create new web user"; break;
Avoid too many return
statements within this method. Open
Open
case "30" : return "Saving settings"; break;
Avoid too many return
statements within this method. Open
Open
case "40" : return "Editing Access Permissions"; break;
Avoid too many return
statements within this method. Open
Open
case "65" : return "Deleting a message"; break;
Avoid too many return
statements within this method. Open
Open
case "98" : return "Duplicate Snippet $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "304" : return "Duplicate Template Variable $itemid"; break;
Avoid too many return
statements within this method. Open
Open
case "998" : return "Viewing web page $itemid"; break;