Showing 7,873 of 7,873 total issues
Function getSMTPConnection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function getSMTPConnection($host, $port = null, $timeout = 30, $options = [])
{
static $streamok;
//This is enabled by default since 5.0.0 but some providers disable it
//Check this once and cache the result
- 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 recordLastTransactionID
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function recordLastTransactionID()
{
$reply = $this->getLastReply();
if (empty($reply)) {
- 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 addStringEmbeddedImage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$string,
$cid,
$name = '',
$encoding = self::ENCODING_BASE64,
$type = '',
Method authorise
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function authorise($host, $port = false, $timeout = false, $username = '', $password = '', $debug_level = 0)
Function encodeQ
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function encodeQ($str, $position = 'text')
{
//There should not be any EOL in the string
$pattern = '';
$encoded = str_replace(["\r", "\n"], '', $str);
- 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 popBeforeSmtp
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$host,
$port = false,
$timeout = false,
$username = '',
$password = '',
Function encodeString
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function encodeString($str, $encoding = self::ENCODING_BASE64)
{
$encoded = '';
switch (strtolower($encoding)) {
case static::ENCODING_BASE64:
- 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 postSend
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function postSend()
{
try {
//Choose the mailer and send through it
switch ($this->Mailer) {
- 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 listEvents
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function listEvents(xPDO &$xpdo, $plugin, array $criteria = array(), array $sort = array('id' => 'ASC'), $limit = 0, $offset = 0) {
Avoid deeply nested control flow statements. Open
if (preg_match("/^[a-z]+$/i", $tag, $regs)) {
$strLower = $usemb ? mb_strtolower($regs[0],$encoding) : strtolower($regs[0]);
if ($strLower != 'br' && $strLower != 'hr') {
$opened[] = $regs[0];
}
Function setUrl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setUrl($ch,$host,$path,$method = 'GET',array $params = array(),array $options = array()) {
$q = http_build_query($params);
switch ($method) {
case 'GET':
$path .= (strpos($host,'?') === false ? '?' : '&').$q;
- 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 renderOutput
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function renderOutput($resourceId= 0) {
$value= $this->getValue($resourceId);
/* process any TV commands in value */
$value= $this->processBindings($value, $resourceId);
- 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 deeply nested control flow statements. Open
if (strpos($key, 'extended.') === 0 && isset($userData['extended'][substr($key, 9)])) {
$userInfo = $userData['extended'][substr($key, 9)];
} elseif (strpos($key, 'remote_data.') === 0 && isset($userData['remote_data'][substr($key, 12)])) {
$userInfo = $userData['remote_data'][substr($key, 12)];
} elseif (isset($userData[$key])) {
Function prepareUrl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function prepareUrl() {
$format = $this->getOption('format','json');
$suppressSuffix = $this->getOption('suppressSuffix',false);
if (!empty($format) && !$suppressSuffix) {
$this->url .= '.'.$format;
- 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 setAuth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setAuth($ch,array $options = array()) {
$auth = false;
if (!empty($options[modRestClient::OPT_USERPWD])) {
$options[modRestClient::OPT_AUTHTYPE] = $this->modx->getOption(modRestClient::OPT_AUTHTYPE,$options,'BASIC');
switch ($options[modRestClient::OPT_AUTHTYPE]) {
- 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 deeply nested control flow statements. Open
if ($breakpoint < $len - 1) {
$partial = $usemb ? mb_substr($output, 0, $breakpoint,$encoding) : substr($output, 0, $breakpoint);
$output = $partial . $pad;
}
Function setProxy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function setProxy($ch,array $options = array()) {
$proxyEnabled = false;
/* if proxy is set, attempt to use it */
$proxyHost = $this->modx->getOption('proxy_host',null,'');
if (!empty($proxyHost)) {
- 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 getController
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function getController() {
$expectedFile = trim($this->request->action,'/');
$basePath = $this->getOption('basePath');
$controllerClassPrefix = $this->getOption('controllerClassPrefix','modController');
$controllerClassSeparator = $this->getOption('controllerClassSeparator','_');
- 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 deeply nested control flow statements. Open
if( $uts['end'] >= $uts['start'] ) {
$diff = $uts['end'] - $uts['start'];
$years = intval((floor($diff/31536000)));
if ($years) $diff = $diff % 31536000;
Method setUrl
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function setUrl($ch,$host,$path,$method = 'GET',array $params = array(),array $options = array()) {