Showing 39 of 299 total issues
Function sendFileMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public final function sendFileMessage($threemaId, $filePath, $thumbnailPath = null) {
//analyse the file
$fileAnalyzeResult = FileAnalysisTool::analyse($filePath);
if(null === $fileAnalyzeResult) {
- 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 byJsonString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static final function byJsonString($string, array $requiredKeys = null) {
$v = json_decode($string, true);
if(null === $v || false === $v) {
throw new Exception('invalid json string');
}
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($blobId, $thumbnailBlobId, $encryptionKey, $mimeType, $filename, $size) {
- Create a ticketCreate a ticket
Function findPublicKey
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function findPublicKey($threemaId) {
$storeHandle = fopen($this->file, 'r');
if(false === $storeHandle) {
throw new Exception('could not open file '.$this->file);
}
- 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 initFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function initFile($fileHandle = null)
{
//check if file does already contain content
if (filesize($this->file) != 0) {
return 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
Method receiveMessage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public final function receiveMessage($threemaId,
$messageId,
$box,
$nonce,
$outputFolder = null,
- Create a ticketCreate a ticket
Method encryptImageMessage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
UploadFileResult $uploadFileResult,
EncryptResult $encryptResult,
$senderPrivateKey,
$recipientPublicKey,
$nonce) {
- Create a ticketCreate a ticket
Function getInstance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function getInstance() {
if(null === self::$instance) {
foreach(array(
function() {
return self::createInstance(self::TYPE_SODIUM);
- 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 writeHelp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function writeHelp(\Closure $writer) {
if(null !== $writer) {
foreach($this->commands as $data) {
if(is_scalar($data)) {
- 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 analyse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function analyse($file) {
//check if file exists
if(false === file_exists($file)) {
return 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
Avoid too many return
statements within this method. Open
return 'A temporary internal server error has occurred';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'Unknown error';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'Unknown error';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'Unknown error';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'A temporary internal server error has occurred';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'Unknown error';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return 'Message is too long';
- Create a ticketCreate a ticket
Avoid too many return
statements within this method. Open
return new FileMessage(
$values->getValue('b'),
$values->getValue('t'),
$values->getValue('k'),
$values->getValue('m'),
- Create a ticketCreate a ticket
Function fetchPublicKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function fetchPublicKey($threemaId) {
$publicKey = null;
if (null !== $this->publicKeyStore) {
$publicKey = $this->publicKeyStore->getPublicKey($threemaId);
- 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"