Showing 104 of 597 total issues
Method processMessage
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function processMessage($downloadPath, $debugMode = false)
{
/** @var string $output */
$output = '';
Function getMessageDataByType
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getMessageDataByType($messageType, $includeMetaData = true)
{
/** @var array $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
Method triggerVerification
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function triggerVerification($context, array $user, $userIp, array &$providerData)
{
parent::triggerVerification($context, $user, $userIp, $providerData);
// this 2FA mode requires end-to-end encryption
Method _getExistingData
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _getExistingData($data)
{
/** @var string $messageId */
if (!$messageId = $this->_getExistingPrimaryKey($data, 'message_id')) {
return false;
Method install
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function install($installedAddon)
{
/** @var array $providerInstaller An array with the models of all providers */
$providerInstaller = self::getProviderInstaller();
// check requirements of Gateway
Method _preSave
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _preSave()
{
// filter data
// also uses existing data as a data base as otherwise the main table
// may also get deleted because of missing message id
Method verifyFromInput
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function verifyFromInput($context, XenForo_Input $input, array $user, array &$providerData)
{
/** @var bool $result from parent, for error checking */
$result = parent::verifyFromInput($context, $input, $user, $providerData);
Method _getFields
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function _getFields()
{
return [
ThreemaGateway_Model_TfaPendingMessagesConfirmation::DB_TABLE => [
'request_id' => [
Method getFileList
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFileList($mimeType = null, $fileType = null, $threemaId = null, $queryMetaData = true)
{
$this->initiate();
$model = XenForo_Model::create('ThreemaGateway_Model_Messages');
Method renderHtml
has 36 lines of code (exceeds 25 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 */
Function isReady
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function isReady()
{
// basic check
if (!$this->isAvaliable()) {
return false;
- 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 getFileList
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getFileList($mimeType = null, $fileType = null, $threemaId = null, $queryMetaData = true)
{
$this->initiate();
$model = XenForo_Model::create('ThreemaGateway_Model_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 verifyFromInput
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function verifyFromInput($context, XenForo_Input $input, array $user, array &$providerData)
{
/** @var bool $result from parent, for error checking */
$result = parent::verifyFromInput($context, $input, $user, $providerData);
- 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 handleMessageDecline
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function handleMessageDecline(array &$providerData, array $user, $userIp = null)
{
/** @var XenForo_Options $xenOptions */
$xenOptions = XenForo_Application::getOptions();
/** @var int $blockingTime seconds how long users should be blocked */
- 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
Method triggerVerification
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function triggerVerification($context, array $user, $userIp, array &$providerData)
{
parent::triggerVerification($context, $user, $userIp, $providerData);
if (!$providerData) {
Function checkTecRequire
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected static function checkTecRequire(array &$status, array &$extraError)
{
// optional check: HTTPS
if (!XenForo_Application::$secure) {
$extraError[]['text'] = new XenForo_Phrase('option_threema_gateway_status_no_https');
- 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
Method createConnectionSettings
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function createConnectionSettings($gatewayId, $gatewaySecret)
{
/** @var XenForo_Options $xenOptions */
$xenOptions = XenForo_Application::getOptions();
Method saveMessage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function saveMessage(
Threema\MsgApi\Helpers\ReceiveMessageResult $receiveResult,
Threema\MsgApi\Messages\ThreemaMessage $threemaMsg
) {
$dataWriter = XenForo_DataWriter::create('ThreemaGateway_DataWriter_Messages');
Method getAllMessageData
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllMessageData(array $metaData, $groupByMessageType = false)
{
// get grouped messages by type
$messageTypes = $this->groupArray($metaData, 'message_type_code');
// we always need to do this (regardless of message_type_code) as each
Method renewCache
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function renewCache($userId)
{
/** @var array $permissions Temporary variable for permissions */
$permissions = [];