File PageOrderImpl.php
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace ChristianBudde\Part\model\page;
use ChristianBudde\Part\BackendSingletonContainer;
use ChristianBudde\Part\controller\ajax\type_handler\TypeHandler;
- Create a ticketCreate a ticket
PageOrderImpl
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class PageOrderImpl implements PageOrder
{
private $database;
private $connection;
- Create a ticketCreate a ticket
Function detectLoop
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private function detectLoop($childID, $parentID)
{
$prevID = $parentID;
$loopDetected = false;
- Read upRead up
- Create a ticketCreate a ticket
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 setPageOrder
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function setPageOrder(Page $page, $place = PageOrder::PAGE_ORDER_LAST, Page $parentPage = null)
{
if ($parentPage instanceof Page) {
if ($this->findPage($parentPage) !== false) {
- Read upRead up
- Create a ticketCreate a ticket
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 createPageInstance
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function createPageInstance($id, $title, $template, $alias, $lastMod, $hidden)
- Create a ticketCreate a ticket
Method createPage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function createPage($id, $title = '', $template = '', $alias = '', $hidden = false)
- Create a ticketCreate a ticket
Function recursiveCalculatePath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function recursiveCalculatePath(Page $page, Page $parent = null)
{
$order = $this->getPageOrder($parent);
foreach ($order as $p) {
/** @var $p Page */
- Read upRead up
- Create a ticketCreate a ticket
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 updatePageOrderId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function updatePageOrderId($oldId, $newId)
{
if (isset($this->pageOrder[$oldId])) {
$this->pageOrder[$newId] = $this->pageOrder[$oldId];
unset($this->pageOrder[$oldId]);
- Read upRead up
- Create a ticketCreate a ticket
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 listPages
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function listPages($listMode = PageOrder::LIST_ALL)
{
$retArray = array();
if ($listMode == PageOrder::LIST_INACTIVE || $listMode == PageOrder::LIST_ALL) {
foreach ($this->inactivePages as $page) {
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid too many return
statements within this method. Open
return $page;
- Create a ticketCreate a ticket
Function removeIDFromSubLists
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function removeIDFromSubLists($pageID)
{
foreach ($this->pageOrder as $parent_id => $orderArray) {
foreach ($orderArray as $order => $page_id) {
if ($page_id == $pageID) {
- Read upRead up
- Create a ticketCreate a ticket
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"