rugk/xenforo-threema-gateway

View on GitHub

Showing 104 of 597 total issues

Function pushArrayKeys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function pushArrayKeys(array &$baseArray, array &$subArray, array $removeKeys)
    {
        foreach ($removeKeys as $key) {
            // skip invalid keys
            if (!array_key_exists($key, $subArray[0])) {
Severity: Minor
Found in src/library/ThreemaGateway/Model/Messages.php - About 25 mins 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 checkPhpSdk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function checkPhpSdk(array &$status, array &$extraError, ThreemaGateway_Handler_Settings $gwSettings = null)
    {
        // auto-create Gateway settings if not given
        if ($gwSettings === null) {
            $gwSettings = new ThreemaGateway_Handler_Settings;
Severity: Minor
Found in src/library/ThreemaGateway/Option/Status.php - About 25 mins 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 verifyOption has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function verifyOption(&$option, XenForo_DataWriter $dataWriter, $fieldName)
    {
        if (!$option || !$option['enabled']) {
            // skip check if option is disabled
            return true;
Severity: Minor
Found in src/library/ThreemaGateway/Option/VerifyReceiveTime.php - About 25 mins 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 _getExistingData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _getExistingData($data)
    {
        /** @var string $messageId */
        if (!$messageId = $this->_getExistingPrimaryKey($data, 'message_id')) {
            return false;
Severity: Minor
Found in src/library/ThreemaGateway/DataWriter/Messages.php - About 25 mins 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

Severity
Category
Status
Source
Language