sebastianmonzel/webfiles-framework-php

View on GitHub

Showing 587 of 587 total issues

Function handleRemoteCall has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleRemoteCall() {

        header("Access-Control-Allow-Headers: *");
        header("Access-Control-Allow-Origin: *");

Severity: Minor
Found in source/core/datastore/types/remote/MRemoteDatastoreEndpoint.php - About 1 day to fix

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

File MDatabaseDatastore.php has 582 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace webfilesframework\core\datastore\types\database;

use Exception;
Severity: Major
Found in source/core/datastore/types/database/MDatabaseDatastore.php - About 1 day to fix

Function getWebfilesByTablename has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    private function getWebfilesByTablename($tableName,$className = null,$condition = null,$order = null)
    {
        $webfileArray = array();


Severity: Minor
Found in source/core/datastore/types/database/MDatabaseDatastore.php - About 6 hrs to fix

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 getDatatypeFromAttributeName has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getDatatypeFromAttributeName($attributeName)
    {
        $typeIdentifier = self::getTypeIdentifier($attributeName);

        if ($typeIdentifier == "s") {
Severity: Minor
Found in source/core/datasystem/file/format/MWebfile.php - About 6 hrs to fix

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 getFormItemByAttributeType has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getFormItemByAttributeType($attributeType, $attributeName, $attributeValue = "", $localizedName = "")
    {

        if ($attributeType == "integer") {
            $formItem = new MTextfieldFormItem($attributeName, $attributeValue, $localizedName);
Severity: Minor
Found in source/io/form/MFormItemFactory.php - About 5 hrs to fix

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 store has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    private function store(MWebfile $webfile, $useOnlySimpleDatatypes = false)
    {

        $tablename = $this->resolveTableNameForWebfile($webfile);

Severity: Minor
Found in source/core/datastore/types/database/MDatabaseDatastore.php - About 4 hrs to fix

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 update has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    private function update(MWebfile $webfile, $useOnlySimpleDatatypes = false)
    {

        $oAttributeArray = $webfile->getAttributes();

Severity: Minor
Found in source/core/datastore/types/database/MDatabaseDatastore.php - About 4 hrs to fix

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

MDatabaseDatastore has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

class MDatabaseDatastore extends MAbstractDatastore
    implements MISingleDatasourceDatastore
{

    private $databaseConnection;
Severity: Minor
Found in source/core/datastore/types/database/MDatabaseDatastore.php - About 4 hrs to fix

File MWebfile.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace webfilesframework\core\datasystem\file\format;
use ReflectionClass;
use ReflectionException;
Severity: Minor
Found in source/core/datasystem/file/format/MWebfile.php - About 4 hrs to fix

Function getFormItemByAttributeName has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getFormItemByAttributeName($attributeName, $attributeValue, $localizedName = "")
    {

        $attributeType = substr($attributeName, 2, 1);

Severity: Minor
Found in source/io/form/MFormItemFactory.php - About 3 hrs to fix

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 createTableColumnFromAttributeName has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function createTableColumnFromAttributeName($sAttributeName)
    {
        $prefix = substr($sAttributeName, 2, 1);
        if ($prefix == "s") { // string (width = 50)
            return new MDatabaseTableColumn(
Severity: Minor
Found in source/core/datastore/types/database/MDatabaseDatastore.php - About 3 hrs to fix

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 translateTemplateIntoCondition has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function translateTemplateIntoCondition(MWebfile $webfile)
    {

        $first = true;
        $condition = "";
Severity: Minor
Found in source/core/datastore/types/database/MDatabaseDatastore.php - About 3 hrs to fix

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 handleRemoteCall has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handleRemoteCall() {

        header("Access-Control-Allow-Headers: *");
        header("Access-Control-Allow-Origin: *");

Severity: Major
Found in source/core/datastore/types/remote/MRemoteDatastoreEndpoint.php - About 3 hrs to fix

The class MDirectoryDatastore has an overall complexity of 62 which is very high. The configured complexity threshold is 50.
Open

class MDirectoryDatastore extends MAbstractCachableDatastore
    implements MISingleDatasourceDatastore
{

    /** @var MDirectory */

The class MImage has 16 public methods. Consider refactoring MImage to keep number of public methods under 10.
Open

class MImage extends MFile
{

    protected $m_oImage;

TooManyPublicMethods

Since: 0.1

A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

Example

Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

The class MDatabaseDatastore has 27 non-getter- and setter-methods. Consider refactoring MDatabaseDatastore to keep number of methods under 25.
Open

class MDatabaseDatastore extends MAbstractDatastore
    implements MISingleDatasourceDatastore
{

    private $databaseConnection;

TooManyMethods

Since: 0.1

A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

By default it ignores methods starting with 'get' or 'set'.

The default was changed from 10 to 25 in PHPMD 2.3.

Example

Source https://phpmd.org/rules/codesize.html#toomanymethods

The class MDatabaseDatastore has an overall complexity of 121 which is very high. The configured complexity threshold is 50.
Open

class MDatabaseDatastore extends MAbstractDatastore
    implements MISingleDatasourceDatastore
{

    private $databaseConnection;

MWebfile has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class MWebfile {

    protected $m_iId = 0;

    /**
Severity: Minor
Found in source/core/datasystem/file/format/MWebfile.php - About 3 hrs to fix

The class MImage has an overall complexity of 51 which is very high. The configured complexity threshold is 50.
Open

class MImage extends MFile
{

    protected $m_oImage;

The class MWebfile has an overall complexity of 80 which is very high. The configured complexity threshold is 50.
Open

class MWebfile {

    protected $m_iId = 0;

    /**
Severity
Category
Status
Source
Language