Showing 597 of 597 total issues
The class ThreemaGateway_Tfa_AbstractProvider has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13. Open
abstract class ThreemaGateway_Tfa_AbstractProvider extends XenForo_Tfa_AbstractProvider
{
/**
* Variable, which will be filled with object of the Gateway Permissions class.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Method renderVerification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function renderVerification(XenForo_View $view, $context, array $user,
array $providerData, array $triggerData)
Method renderVerification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function renderVerification(XenForo_View $view, $context, array $user,
array $providerData, array $triggerData)
Method renderVerification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function renderVerification(XenForo_View $view, $context, array $user,
array $providerData, array $triggerData)
Method renderVerification
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function renderVerification(XenForo_View $view, $context, array $user,
array $providerData, array $triggerData)
Function checkForDeliveryReceipt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function checkForDeliveryReceipt(ThreemaGateway_Handler_Action_Callback $handler,
Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
Threema\MsgApi\Messages\ThreemaMessage $threemaMsg,
&$output,
&$saveMessage,
- 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 renderHtml
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function renderHtml(XenForo_View $view, $fieldPrefix, array $preparedOption, $canEdit)
{
/** @var array $status */
$status = ['libsodium', 'libsodiumphp', 'phpsdk', 'credits'];
/** @var array $extraError */
- 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 addLog
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addLog(&$log, $stringToAdd, $stringToAddDetail = null)
{
// convert to array if necessary or just add string
if (is_string($log)) {
if ($stringToAddDetail) {
- 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 saveMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function saveMessage(
Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
Threema\MsgApi\Messages\ThreemaMessage $threemaMsg
) {
$dataWriter = XenForo_DataWriter::create('ThreemaGateway_DataWriter_Messages');
- 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 checkForReceiverCode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function checkForReceiverCode(ThreemaGateway_Handler_Action_Callback $handler,
Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
Threema\MsgApi\Messages\ThreemaMessage $threemaMsg,
&$output,
&$saveMessage,
- 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 setDataForRequest
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function setDataForRequest(
array $confirmRequest,
array $setData,
array $processOptions = []
) {
- 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 setUserId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setUserId($newUser = null)
{
// get user ids (or null)
if ($this->user === null) {
/** @var int|null $oldUserId User id of user (from class) */
- 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 applyFilter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function applyFilter($filterType, $filterData, $failOnError = true)
{
/** @var $success bool */
$success = true;
- 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 processMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function processMessage($downloadPath, $debugMode = false)
{
/** @var string $output */
$output = '';
- 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
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return null;
The method getMessageMetaData has a boolean flag argument $groupById, which is a certain sign of a Single Responsibility Principle violation. Open
public function getMessageMetaData($groupById = false, $ignoreInvalid = true)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $controller->responseView(
'ThreemaGateway_ViewPublic_TfaManage',
'account_two_step_' . $this->_providerId . '_manage',
$viewParams
);
The method getAllMessageData has a boolean flag argument $groupByMessageType, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAllMessageData(array $metaData, $groupByMessageType = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}