Showing 39 of 299 total issues
Function receiveMessage
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public final function receiveMessage($threemaId,
$messageId,
$box,
$nonce,
$outputFolder = null,
- 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
CryptTool
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class CryptTool {
const TYPE_SODIUM = 'sodium';
const TYPE_SALT = 'salt';
const FILE_NONCE = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01";
- Create a ticketCreate a ticket
Method receiveMessage
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
public final function receiveMessage($threemaId,
$messageId,
$box,
$nonce,
$outputFolder = null,
- Create a ticketCreate a ticket
File CryptTool.php
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* @author Threema GmbH
* @copyright Copyright (c) 2015-2016 Threema GmbH
*/
- Create a ticketCreate a ticket
Method decryptMessage
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function decryptMessage($box, $recipientPrivateKey, $senderPublicKey, $nonce) {
$data = $this->openBox($box, $recipientPrivateKey, $senderPublicKey, $nonce);
if (null === $data || strlen($data) == 0) {
- Create a ticketCreate a ticket
Function createDefaultOptions
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function createDefaultOptions(\Closure $progress = null) {
$options = array(
CURLOPT_RETURNTRANSFER => true
);
- 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 run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function run() {
$found = null;
$argumentLength = 0;
//find the correct command by arguments and arguments count
- 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 createDefaultOptions
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function createDefaultOptions(\Closure $progress = null) {
$options = array(
CURLOPT_RETURNTRANSFER => true
);
- Create a ticketCreate a ticket
Method doRun
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function doRun() {
$cryptTool = CryptTool::getInstance();
$sendersThreemaId = $this->getArgumentThreemaId(self::argThreemaId);
$id = $this->getArgumentThreemaId(self::argFrom);
- Create a ticketCreate a ticket
Method run
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run() {
$found = null;
$argumentLength = 0;
//find the correct command by arguments and arguments count
- Create a ticketCreate a ticket
Function __construct
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($threemaId, $secret, $host = null, array $tlsOptions = null) {
$this->threemaId = $threemaId;
$this->secret = $secret;
if ($host === null) {
$host = 'https://msgapi.threema.ch';
- 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 sendFileMessage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public final function sendFileMessage($threemaId, $filePath, $thumbnailPath = null) {
//analyse the file
$fileAnalyzeResult = FileAnalysisTool::analyse($filePath);
if(null === $fileAnalyzeResult) {
- Create a ticketCreate a ticket
Method initFile
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function initFile($fileHandle = null)
{
//check if file does already contain content
if (filesize($this->file) != 0) {
return true;
- Create a ticketCreate a ticket
Method sendImageMessage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public final function sendImageMessage($threemaId, $imagePath) {
//analyse the file
$fileAnalyzeResult = FileAnalysisTool::analyse($imagePath);
if(null === $fileAnalyzeResult) {
- Create a ticketCreate a ticket
Method checkMac
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public final function checkMac($threemaId, $gatewayId, $messageId, $date, $nonce, $box, $mac, $secret) {
- Create a ticketCreate a ticket
Function decryptMessage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
final public function decryptMessage($box, $recipientPrivateKey, $senderPublicKey, $nonce) {
$data = $this->openBox($box, $recipientPrivateKey, $senderPublicKey, $nonce);
if (null === $data || strlen($data) == 0) {
- 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 stringCompare
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function stringCompare($str1, $str2)
{
if (function_exists('hash_equals')) {
return hash_equals($str1, $str2);
} else {
- 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 register
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function register($argumentKey, Base $command) {
if(is_scalar($argumentKey)) {
$argumentKey = array($argumentKey);
}
- 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 call
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function call($path, array $curlOptions, array $parameters = null, \Closure $result = null) {
$fullPath = new Url('', $this->setting->getHost());
$fullPath->addPath($path);
if (null !== $parameters && count($parameters)) {
- 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 encryptFileMessage
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
final public function encryptFileMessage(UploadFileResult $uploadFileResult,
EncryptResult $encryptResult,
UploadFileResult $thumbnailUploadFileResult = null,
FileAnalysisResult $fileAnalysisResult,
$senderPrivateKey,
- Create a ticketCreate a ticket