File Record.php
has 575 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* OSSMail record model file.
*
* @package Model
Function initMailPart
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
protected static function initMailPart($mbox, $mail, $partStructure, $partNum)
{
if ($partNum) {
\App\Log::beginProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
- 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 imapConnect
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
{
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
if (!$config) {
$config = self::loadRoundcubeConfig();
- 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 unfoldFlowed
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
protected static function unfoldFlowed(string $text, bool $delSp = false): string
{
$text = preg_split('/\r?\n/', $text);
$last = -1;
$qLevel = 0;
- 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 imapConnect
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
{
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
if (!$config) {
$config = self::loadRoundcubeConfig();
Method initMailPart
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function initMailPart($mbox, $mail, $partStructure, $partNum)
{
if ($partNum) {
\App\Log::beginProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
The class OSSMail_Record_Model has an overall complexity of 167 which is very high. The configured complexity threshold is 50. Open
class OSSMail_Record_Model extends Vtiger_Record_Model
{
/** @var int Mailbox Status: Active */
const MAIL_BOX_STATUS_ACTIVE = 0;
- Exclude checks
Function updateMailBoxCounter
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public static function updateMailBoxCounter(array $users): array
{
if (empty($users)) {
return [];
}
- 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 getMail
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getMail($mbox, $id, $msgno = false, bool $fullMode = true)
{
if (!$msgno) {
\App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
$msgno = imap_msgno($mbox, $id);
Method unfoldFlowed
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected static function unfoldFlowed(string $text, bool $delSp = false): string
{
$text = preg_split('/\r?\n/', $text);
$last = -1;
$qLevel = 0;
Method updateMailBoxCounter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function updateMailBoxCounter(array $users): array
{
if (empty($users)) {
return [];
}
Function getMailsFromIMAP
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function getMailsFromIMAP(?int $user = null)
{
$accounts = self::getAccountsList(false, true);
$mails = [];
$mailLimit = 5;
- 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 imapConnect
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
Consider simplifying this complex logical expression. Open
if (isset($text[$last]) && $line && !$qLevel
&& '-- ' !== $text[$last]
&& isset($text[$last][\strlen($text[$last]) - 1]) && ' ' === $text[$last][\strlen($text[$last]) - 1]
) {
if ($delSp) {
Function getMail
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function getMail($mbox, $id, $msgno = false, bool $fullMode = true)
{
if (!$msgno) {
\App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
$msgno = imap_msgno($mbox, $id);
- 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 getFullName
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getFullName($text)
{
$return = '';
foreach ($text as $row) {
if ('' != $return) {
- 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
The method imapConnect() has an NPath complexity of 1898208. The configured NPath complexity threshold is 200. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
{
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
if (!$config) {
$config = self::loadRoundcubeConfig();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method imapConnect() has 101 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
{
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
if (!$config) {
$config = self::loadRoundcubeConfig();
- Exclude checks
The method initMailPart() has an NPath complexity of 2484000. The configured NPath complexity threshold is 200. Open
protected static function initMailPart($mbox, $mail, $partStructure, $partNum)
{
if ($partNum) {
\App\Log::beginProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method unfoldFlowed() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10. Open
protected static function unfoldFlowed(string $text, bool $delSp = false): string
{
$text = preg_split('/\r?\n/', $text);
$last = -1;
$qLevel = 0;
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method imapConnect() has a Cyclomatic Complexity of 32. The configured cyclomatic complexity threshold is 10. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
{
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
if (!$config) {
$config = self::loadRoundcubeConfig();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method initMailPart() has a Cyclomatic Complexity of 45. The configured cyclomatic complexity threshold is 10. Open
protected static function initMailPart($mbox, $mail, $partStructure, $partNum)
{
if ($partNum) {
\App\Log::beginProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 77 to the 15 allowed. Open
protected static function initMailPart($mbox, $mail, $partStructure, $partNum)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 37 to the 15 allowed. Open
protected static function unfoldFlowed(string $text, bool $delSp = false): string
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 22 to the 15 allowed. Open
public static function updateMailBoxCounter(array $users): array
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 54 to the 15 allowed. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Avoid using undefined variables such as '$config' which will lead to PHP notices. Open
return $configMail + $config;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The class OSSMail_Record_Model has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13. Open
class OSSMail_Record_Model extends Vtiger_Record_Model
{
/** @var int Mailbox Status: Active */
const MAIL_BOX_STATUS_ACTIVE = 0;
- 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
The method getAccountsList has a boolean flag argument $onlyMy, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAccountsList($user = false, bool $onlyMy = false, bool $password = false, bool $onlyActive = 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
The method getMail has a boolean flag argument $fullMode, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getMail($mbox, $id, $msgno = false, bool $fullMode = 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
Missing class import via use statement (line '319', column '15'). Open
$mail = new OSSMail_Mail_Model();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getAccountsList has a boolean flag argument $password, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAccountsList($user = false, bool $onlyMy = false, bool $password = false, bool $onlyActive = 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
Missing class import via use statement (line '782', column '19'). Open
$result = (new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '107', column '15'). Open
throw new \App\Exceptions\AppException('Unable to find a Roundcube version');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getAccountsList has a boolean flag argument $user, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAccountsList($user = false, bool $onlyMy = false, bool $password = false, bool $onlyActive = 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
The method unfoldFlowed has a boolean flag argument $delSp, which is a certain sign of a Single Responsibility Principle violation. Open
protected static function unfoldFlowed(string $text, bool $delSp = false): string
- 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
Missing class import via use statement (line '65', column '17'). Open
$query = (new \App\Db\Query())->from('roundcube_users');
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '372', column '16'). Open
$user = (new \App\Db\Query())->from('roundcube_users')->where(['user_id' => $userid, 'crm_status' => [self::MAIL_BOX_STATUS_INVALID_ACCESS, self::MAIL_BOX_STATUS_ACTIVE]])->one();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getAccountsList has a boolean flag argument $onlyActive, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getAccountsList($user = false, bool $onlyMy = false, bool $password = false, bool $onlyActive = 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
The method imapConnect has a boolean flag argument $dieOnError, which is a certain sign of a Single Responsibility Principle violation. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
- 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
Missing class import via use statement (line '237', column '15'). Open
throw new \App\Exceptions\AppException('IMAP_ERROR' . ': ' . imap_last_error());
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '260', column '15'). Open
$all = (new \App\Db\Query())->from('u_#__mail_quantities')->where(['userid' => $users])->indexBy('userid')->all();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getMail has a boolean flag argument $msgno, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getMail($mbox, $id, $msgno = false, bool $fullMode = 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 using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::beginProfile('OSSMail_Record_Model|imap_close|' . $user, 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method imapConnect uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ($account) {
$status = self::MAIL_BOX_STATUS_ACTIVE == $account['crm_status'] ? self::MAIL_BOX_STATUS_INVALID_ACCESS : self::MAIL_BOX_STATUS_BLOCKED_TEMP;
[$date] = explode('||', $account['crm_error'] ?: '');
if (empty($date) || false === strtotime($date)) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Utils' in method 'getFolders'. Open
$name = \App\Utils::convertCharacterEncoding($name, 'UTF7-IMAP', 'UTF-8');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::trace('Exit OSSMail_Record_Model::imapConnect() method ...');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'getMail'. Open
$mail->set('reply_toaddress', \App\Purifier::purify($mail->getEmail('reply_to')));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method unfoldFlowed uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text[$idx] = $line;
$last = $idx;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'updateMailBoxCounter'. Open
\App\Log::endProfile(__METHOD__ . '|imap_status|' . $user, 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'loadRoundcubeConfig'. Open
$configMail = \App\Config::module('OSSMail');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::trace('imap_open(({' . static::$imapConnectMailbox . ", $user , '****'. $options, $maxRetries, " . var_export($params, true) . ') method ...');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'updateMailBoxCounter'. Open
\App\Log::error($th->__toString());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getBodyAttach uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
foreach ($struct->parts as $partNum => $partStructure) {
$mail = self::initMailPart($mbox, $mail, $partStructure, $partNum + 1);
}
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'initMailPart'. Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method initMailPart uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$mail = self::initMailPart($mbox, $mail, $subPartStructure, $partNum . '.' . ($subPartNum + 1));
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method unfoldFlowed uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if ('-- ' == $line) {
$last = $idx;
} else {
if (isset($line[0]) && ' ' === $line[0]) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_open|' . $user, 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::endProfile('OSSMail_Record_Model|imap_close|' . $user, 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::error('Error OSSMail_Record_Model::imapConnect(' . static::$imapConnectMailbox . '): ' . imap_last_error());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Mail_Config_Model' in method 'updateMailBoxCounter'. Open
$config = Settings_Mail_Config_Model::getConfig('mailIcon');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\TextUtils' in method 'getMail'. Open
$mail->set('firstLetterBg', strtoupper(\App\TextUtils::textTruncate(trim(strip_tags(App\Purifier::purify($mail->getEmail('from')))), 1, false)));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'getMail'. Open
$mail->set('subject', isset($header->subject) ? \App\TextUtils::textTruncate(\App\Purifier::purify(self::decodeText($header->subject)), 65535, false) : '');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method imapConnect uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$sslMode = '';
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'initMailPart'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'initMailPart'. Open
\App\Log::endProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'updateMailBoxCounter'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_status|' . $user, 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::endProfile(__METHOD__ . '|imap_headerinfo', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method unfoldFlowed uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$last = $idx;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\User' in method 'getAccountsList'. Open
$userModel = \App\User::getCurrentUserModel();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method initMailPart uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$params[$paramName] = $param->value;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'getMailsFromIMAP'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method loadRoundcubeConfig uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
throw new \App\Exceptions\AppException('Unable to find a Roundcube version');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Purifier' in method 'getMail'. Open
$mail->set('message_id', $messageId ? \App\Purifier::purifyByType($messageId, 'MailId') : '');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetch_overview', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method decodeText uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$text .= iconv($charset, 'UTF-8', $row->text);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '619', column '8'). Open
protected static function unfoldFlowed(string $text, bool $delSp = false): string
{
$text = preg_split('/\r?\n/', $text);
$last = -1;
$qLevel = 0;
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Log' in method 'getMailsFromIMAP'. Open
\App\Log::endProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'getMail'. Open
$mail->set('to_email', \App\Purifier::purify($mail->getEmail('to')));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'initMailPart'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method initMailPart uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
\App\Log::beginProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
$data = $orgData = imap_body($mbox, $mail['id'], FT_UID | FT_PEEK);
\App\Log::endProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '263', column '9'). Open
public static function updateMailBoxCounter(array $users): array
{
if (empty($users)) {
return [];
}
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Purifier' in method 'getMail'. Open
$mail->set('from_email', \App\Purifier::purify($mail->getEmail('from')));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getBodyAttach'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchstructure', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getBodyAttach'. Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchstructure', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method initMailPart uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fileName = !empty($params['filename']) ? $params['filename'] : $params['name'];
$fileName = self::decodeText($fileName);
$fileName = self::decodeRFC2231($fileName);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Purifier' in method 'getMail'. Open
$mail->set('firstLetterBg', strtoupper(\App\TextUtils::textTruncate(trim(strip_tags(App\Purifier::purify($mail->getEmail('from')))), 1, false)));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\TextUtils' in method 'getMail'. Open
$mail->set('subject', isset($header->subject) ? \App\TextUtils::textTruncate(\App\Purifier::purify(self::decodeText($header->subject)), 65535, false) : '');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchheader', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_headerinfo', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'getMail'. Open
$mail->set('bcc_email', \App\Purifier::purify($mail->getEmail('bcc')));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getFullName uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$return .= self::decodeText($row->personal) . ' - ' . $row->mailbox . '@' . $row->host;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method unfoldFlowed uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (isset($line[0]) && ' ' === $line[0]) {
$line = substr($line, 1);
}
if (isset($text[$last]) && $line && !$qLevel
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid assigning values to variables in if clauses and the like (line '154', column '8'). Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
{
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
if (!$config) {
$config = self::loadRoundcubeConfig();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
The method updateMailBoxCounter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$counter[$user] = $all[$user]['num'] ?? 0;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchheader', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method 'getSiteUrl'. Open
$site_URL = App\Config::main('site_URL');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getMailsFromIMAP uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$account = reset($accounts);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'imapConnect'. Open
\App\Log::endProfile(__METHOD__ . '|imap_open|' . $user, 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\TextUtils' in method 'imapConnect'. Open
'crm_error' => \App\TextUtils::textTruncate($date . '||' . imap_last_error(), 250),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method updateMailBoxCounter uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$dbCommand->update('u_#__mail_quantities', ['date' => date('Y-m-d H:i:s')], ['userid' => $user])->execute();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::endProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'getMail'. Open
$mail->set('cc_email', \App\Purifier::purify($mail->getEmail('cc')));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::endProfile(__METHOD__ . '|imap_fetch_overview', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'OSSMailScanner_Record_Model' in method 'imapConnect'. Open
}
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Log' in method 'getMail'. Open
\App\Log::endProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method initMailPart uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$encodedData = iconv($params['charset'], 'UTF-8', $data);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method initMailPart uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
if (!isset($mail['textHtml'])) {
$mail['textHtml'] = '';
}
if ($data && '<' !== $data[0] && '<' === $orgData[0]) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Define a constant instead of duplicating this literal "filename" 6 times. Open
$attachmentId = $partStructure->ifid ? trim($partStructure->id, ' <>') : (isset($params['filename']) || isset($params['name']) ? random_int(0, PHP_INT_MAX) . random_int(0, PHP_INT_MAX) : null);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Y-m-d H:i:s" 6 times. Open
$date = date('Y-m-d H:i:s');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "mail_host" 4 times. Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "attachments" 9 times. Open
$mail->set('attachments', $structure['attachment']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "charset" 5 times. Open
if (!empty($params['charset']) && 'utf-8' !== strtolower($params['charset'])) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "u_#__mail_quantities" 4 times. Open
$all = (new \App\Db\Query())->from('u_#__mail_quantities')->where(['userid' => $users])->indexBy('userid')->all();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "user_id" 8 times. Open
$query->andWhere(['user_id' => $user]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Mail|IMAP" 24 times. Open
\App\Log::beginProfile(__METHOD__ . '|imap_open|' . $user, 'Mail|IMAP');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "textPlain" 8 times. Open
$body = (!empty($mail['textPlain'])) ? $mail['textPlain'] : $body;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "isHtml" 3 times. Open
$mail->set('isHtml', $structure['isHtml']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "crm_error" 3 times. Open
->update('roundcube_users', ['crm_error' => null, 'crm_status' => self::MAIL_BOX_STATUS_ACTIVE], ['user_id' => $account['user_id']])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "UTF-8" 4 times. Open
$text .= iconv($charset, 'UTF-8', $row->text);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "actions" 3 times. Open
$row['actions'] = empty($row['actions']) ? [] : explode(',', $row['actions']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "utf-8" 3 times. Open
$text .= mb_convert_encoding($row->text, 'utf-8', $charset);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "userid" 5 times. Open
$all = (new \App\Db\Query())->from('u_#__mail_quantities')->where(['userid' => $users])->indexBy('userid')->all();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "crm_status" 5 times. Open
$query->where(['crm_status' => [self::MAIL_BOX_STATUS_INVALID_ACCESS, self::MAIL_BOX_STATUS_ACTIVE]]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "attachment" 4 times. Open
$mail->set('attachments', $structure['attachment']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "textHtml" 6 times. Open
$body = (!empty($mail['textHtml'])) ? $mail['textHtml'] : $body;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "INBOX" 4 times. Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "password" 4 times. Open
$query->andWhere(['<>', 'password', '']);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "username" 3 times. Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "scheme" 3 times. Open
$sslMode = (isset($parseHost['scheme']) && \in_array($parseHost['scheme'], ['ssl', 'imaps', 'tls'])) ? $parseHost['scheme'] : null;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "roundcube_users" 6 times. Open
$query = (new \App\Db\Query())->from('roundcube_users');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid unused local variables such as '$hostDomain'. Open
foreach ($hosts as $configHost => $hostDomain) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused parameters such as '$msgno'. Open
public static function getBodyAttach($mbox, $id, $msgno)
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused local variables such as '$config'. Open
return $configMail + $config;
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_open|' . $user, 'Mail|IMAP');
- Exclude checks
Default value for int
$msgno
can't be false
Open
public static function getMail($mbox, $id, $msgno = false, bool $fullMode = true)
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$user = (new \App\Db\Query())->from('roundcube_users')->where(['user_id' => $userid, 'crm_status' => [self::MAIL_BOX_STATUS_INVALID_ACCESS, self::MAIL_BOX_STATUS_ACTIVE]])->one();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_open|' . $user, 'Mail|IMAP');
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \FT_PEEK
Open
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_status|' . $user, 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \FT_UID
Open
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
- Exclude checks
Argument 1 (mbox)
is \IMAP\Connection|false
but \OSSMail_Record_Model::getMail()
takes resource
defined at /code/modules/OSSMail/models/Record.php:297
Open
$mail = self::getMail($imap, false, $i);
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchstructure', 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \FT_PEEK
Open
$data = $orgData = imap_body($mbox, $mail['id'], FT_UID | FT_PEEK);
- Exclude checks
Call to method getInstance
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
$imap = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', true, [], $account);
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');
- Exclude checks
Argument 2 (id)
is false
but \OSSMail_Record_Model::getMail()
takes int
defined at /code/modules/OSSMail/models/Record.php:297
Open
$mail = self::getMail($imap, false, $i);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$result = (new \App\Db\Query())
- Exclude checks
Variable $config
is undeclared Open
return $configMail + $config;
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile('OSSMail_Record_Model|imap_close|' . $user, 'Mail|IMAP');
- Exclude checks
Invalid offset "crm_status"
of array type array{}
Open
$status = self::MAIL_BOX_STATUS_ACTIVE == $account['crm_status'] ? self::MAIL_BOX_STATUS_INVALID_ACCESS : self::MAIL_BOX_STATUS_BLOCKED_TEMP;
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
- Exclude checks
Argument 2 (sequence)
is int
but \imap_fetch_overview()
takes string
Open
$msgs = imap_fetch_overview($mbox, $msgno);
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchheader', 'Mail|IMAP');
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchstructure', 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \FT_UID
Open
$struct = imap_fetchstructure($mbox, $id, FT_UID);
- Exclude checks
Argument 3 (section)
is int
but \imap_fetchbody()
takes string
Open
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_headerinfo', 'Mail|IMAP');
- Exclude checks
Argument 1 (stream_id)
is \IMAP\Connection
but \imap_list()
takes resource
Open
$list = imap_list($mbox, $ref, '*');
- Exclude checks
Call to method getCurrentUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('imap_open(({' . static::$imapConnectMailbox . ", $user , '****'. $options, $maxRetries, " . var_export($params, true) . ') method ...');
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile('OSSMail_Record_Model|imap_close|' . $user, 'Mail|IMAP');
- Exclude checks
Invalid offset "crm_error"
of array type array{}
Open
[$date] = explode('||', $account['crm_error'] ?: '');
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \RCUBE_INSTALL_PATH
Open
if (!\defined('RCMAIL_VERSION') && file_exists(RCUBE_INSTALL_PATH . '/program/include/iniset.php')) {
- Exclude checks
Reference to undeclared constant \SA_UNSEEN
Open
$info = imap_status($mbox, static::$imapConnectMailbox, SA_UNSEEN);
- Exclude checks
Invalid offset "user_id"
of array type array{}
Open
->update('roundcube_users', ['crm_error' => null, 'crm_status' => self::MAIL_BOX_STATUS_ACTIVE], ['user_id' => $account['user_id']])
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchheader', 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \RCUBE_INSTALL_PATH
Open
$iniset = file_get_contents(RCUBE_INSTALL_PATH . '/program/include/iniset.php');
- Exclude checks
Returning type float|int
but loadRoundcubeConfig()
is declared to return array
Open
return $configMail + $config;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
\App\Log::trace('Exit OSSMail_Record_Model::imapConnect() method ...');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from('roundcube_users');
- Exclude checks
Return type of imapConnect()
is undeclared type \IMAP\Connection
Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
- Exclude checks
Call to method getConfig
from undeclared class \OSSMailScanner_Record_Model
Open
if (self::MAIL_BOX_STATUS_BLOCKED_TEMP === $status && strtotime('-' . (OSSMailScanner_Record_Model::getConfig('blocked')['permanentTime'] ?? '2 day')) > strtotime($date)) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
return \App\Db::getInstance()->createCommand()->update('roundcube_users', $data, ['user_id' => $userId])->execute();
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_fetch_overview', 'Mail|IMAP');
- Exclude checks
string
passed to foreach instead of array Open
foreach ($text as $row) {
- Exclude checks
Argument 4 (partNum)
is string
but \OSSMail_Record_Model::initMailPart()
takes int
defined at /code/modules/OSSMail/models/Record.php:466
Open
$mail = self::initMailPart($mbox, $mail, $subPartStructure, $partNum . '.' . ($subPartNum + 1));
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$all = (new \App\Db\Query())->from('u_#__mail_quantities')->where(['userid' => $users])->indexBy('userid')->all();
- Exclude checks
Call to method getInstance
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_status|' . $user, 'Mail|IMAP');
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_headerinfo', 'Mail|IMAP');
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \IMAP_OPENTIMEOUT
Open
imap_timeout(IMAP_OPENTIMEOUT, 5);
- Exclude checks
Invalid offset "user_id"
of array type array{}
Open
], ['user_id' => $account['user_id']])
- Exclude checks
Argument 1 (stream_id)
is \IMAP\Connection
but \imap_status()
takes resource
Open
$info = imap_status($mbox, static::$imapConnectMailbox, SA_UNSEEN);
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error($th->__toString());
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetch_overview', 'Mail|IMAP');
- Exclude checks
Reference to undeclared constant \FT_UID
Open
$data = $orgData = imap_body($mbox, $mail['id'], FT_UID | FT_PEEK);
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
\App\Log::error('Error OSSMail_Record_Model::imapConnect(' . static::$imapConnectMailbox . '): ' . imap_last_error());
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');
- Exclude checks
Call to method getInstance
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Exclude checks
Argument 1 (stream_id)
is \IMAP\Connection|false
but \imap_num_msg()
takes resource
Open
$numMessages = imap_num_msg($imap);
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class OSSMail_Record_Model extends Vtiger_Record_Model
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getBodyAttach($mbox, $id, $msgno)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getMail($mbox, $id, $msgno = false, bool $fullMode = true)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $q. Configured minimum length is 3. Open
if ($q = strspn($line, '>')) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class OSSMail_Record_Model is not named in CamelCase. Open
class OSSMail_Record_Model extends Vtiger_Record_Model
{
/** @var int Mailbox Status: Active */
const MAIL_BOX_STATUS_ACTIVE = 0;
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $m. Configured minimum length is 3. Open
if (!preg_match($uu_regexp_end, $input, $m, PREG_OFFSET_CAPTURE, $startpos)) {
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Mailbox Status: Blocked temporarily */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Mailbox Status: Blocked permanently */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const MAIL_BOX_STATUS_BLOCKED_PERM = 4;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const MAIL_BOX_STATUS_BLOCKED_TEMP = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Mailbox Status: Active */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const MAIL_BOX_STATUS_INVALID_ACCESS = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Mailbox Status: Invalid access data */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Mailbox Status: Disabled */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string[] Mailbox status labels */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const MAIL_BOX_STATUS_ACTIVE = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const MAIL_BOX_STATUS_DISABLED = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const MAIL_BOX_STATUS_LABELS = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::MAIL_BOX_STATUS_BLOCKED_TEMP => 'LBL_ACCOUNT_IS_BLOCKED_TEMP',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get status label.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->from('roundcube_users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->innerJoin('roundcube_users_autologin', 'roundcube_users_autologin.rcuser_id = roundcube_users.user_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $host
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::MAIL_BOX_STATUS_LABELS[$status];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAccountsList($user = false, bool $onlyMy = false, bool $password = false, bool $onlyActive = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($onlyActive) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\defined('RCMAIL_VERSION') && file_exists(RCUBE_INSTALL_PATH . '/program/include/iniset.php')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace("Entering OSSMail_Record_Model::imapConnect($user , '****' , $folder) method ...");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($imapHost = $config['imap_host'] ?? '') {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
imap_timeout(IMAP_OPENTIMEOUT, 5);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($onlyMy) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$iniset = file_get_contents(RCUBE_INSTALL_PATH . '/program/include/iniset.php');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $dieOnError
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $onlyMy
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$query->innerJoin('roundcube_users_autologin', 'roundcube_users_autologin.rcuser_id = roundcube_users.user_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($password) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hosts = \is_string($imapHost) ? [$imapHost => $imapHost] : $imapHost;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($parseHost['port'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $status
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->where(['crm_status' => [self::MAIL_BOX_STATUS_INVALID_ACCESS, self::MAIL_BOX_STATUS_ACTIVE]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$crmUsers[] = $userModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['actions'] = empty($row['actions']) ? [] : explode(',', $row['actions']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function loadRoundcubeConfig()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $configMail + $config;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sslMode = (isset($parseHost['scheme']) && \in_array($parseHost['scheme'], ['ssl', 'imaps', 'tls'])) ? $parseHost['scheme'] : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
public static function getAccountsList($user = false, bool $onlyMy = false, bool $password = false, bool $onlyActive = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users[$row['user_id']] = $row;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\define('RCMAIL_VERSION', $rcubeVersion);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* $imapConnectMailbox.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$hosts = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$validateCert = '/novalidate-cert';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $password
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$configMail = \App\Config::module('OSSMail');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// read rcube version from iniset
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match('/define\(.RCMAIL_VERSION.,\s*.([0-9.]+[a-z-]*)?/', $iniset, $matches)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Imap connection cache.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $imapConnectCache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = self::loadRoundcubeConfig();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheName = $user . $host . $folder;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sslMode = 'tls';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Returns Roundcube configuration.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\define('RCUBE_VERSION', $rcubeVersion);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return imap connection resource.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $account
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$imapConnectCache[$cacheName];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::MAIL_BOX_STATUS_INVALID_ACCESS => 'LBL_ACCOUNT_INVALID_ACCESS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$users = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userModel = \App\User::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['roundcube_users_autologin.crmuser_id' => $crmUsers]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $config
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$port = 993;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return IMAP\Connection|false
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$sslMode = (isset($parseHost['scheme']) && \in_array($parseHost['scheme'], ['ssl', 'imaps', 'tls'])) ? $parseHost['scheme'] : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$validateCert = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$config['validate_cert'] && $config['imap_open_add_connection_type']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::MAIL_BOX_STATUS_DISABLED => 'LBL_ACCOUNT_IS_DISABLED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::MAIL_BOX_STATUS_BLOCKED_PERM => 'LBL_ACCOUNT_IS_BLOCKED_PERM',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$crmUsers = $userModel->getGroups();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $users;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $imapConnectMailbox = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $password
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parseHost = parse_url($host);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return accounts array.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $onlyActive
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['<>', 'password', '']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rcubeVersion = str_replace('-git', '.999', $matches[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$config) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($parseHost['host'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getStatusLabel(int $status): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['user_id' => $user]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($hosts as $configHost => $hostDomain) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($parsedConfigHost['host']) && $parsedConfigHost['host'] === $host) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parseHost = $parsedConfigHost;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sslMode = '/' . $sslMode;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
public static function imapConnect($user, $password, $host = '', $folder = 'INBOX', $dieOnError = true, $config = [], array $account = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('Unable to find a Roundcube version');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$imapConnectCache[$cacheName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$port = 143;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sslMode = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|bool $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
include 'public_html/modules/OSSMail/roundcube/config/defaults.inc.php';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $folder Character encoding UTF7-IMAP
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$parsedConfigHost = parse_url($configHost);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($parseHost['host'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$host = $parseHost['host'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$port = $parseHost['port'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($sslMode && 'tls' !== $sslMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($config['imap_open_add_connection_type'] && $sslMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'failed_login' => date('Y-m-d H:i:s'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\AppException('IMAP_ERROR' . ': ' . imap_last_error());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$interval = $config['timeCheckingMail'] ?? 30;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($mbox) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param resource $mbox
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $msgno
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_headerinfo', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('from_email', \App\Purifier::purify($mail->getEmail('from')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_open|' . $user, 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
register_shutdown_function(function () use ($mbox, $user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($config['imap_params'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($mbox) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('Exit OSSMail_Record_Model::imapConnect() method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($all[$user]['date']) || $date > strtotime($all[$user]['date'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$messageId = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = new OSSMail_Mail_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('Msgno', $header->Msgno);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update('roundcube_users', ['crm_error' => null, 'crm_status' => self::MAIL_BOX_STATUS_ACTIVE], ['user_id' => $account['user_id']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($account) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update mailbox mesages info for users.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $users
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('message_id', $messageId ? \App\Purifier::purifyByType($messageId, 'MailId') : '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_open|' . $user, 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$imapConnectCache[$cacheName] = $mbox;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw $e;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($dieOnError) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($users)) {
- Exclude checks
Line exceeds 120 characters; contains 188 characters Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$status = self::MAIL_BOX_STATUS_ACTIVE == $account['crm_status'] ? self::MAIL_BOX_STATUS_INVALID_ACCESS : self::MAIL_BOX_STATUS_BLOCKED_TEMP;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$date] = explode('||', $account['crm_error'] ?: '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::MAIL_BOX_STATUS_BLOCKED_TEMP === $status && strtotime('-' . (OSSMailScanner_Record_Model::getConfig('blocked')['permanentTime'] ?? '2 day')) > strtotime($date)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$all = (new \App\Db\Query())->from('u_#__mail_quantities')->where(['userid' => $users])->indexBy('userid')->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->insert('u_#__mail_quantities', ['userid' => $user, 'num' => 0, 'date' => date('Y-m-d H:i:s')])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $fullMode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('reply_toaddress', \App\Purifier::purify($mail->getEmail('reply_to')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxRetries = $options = 0;
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
->update('roundcube_users', ['crm_error' => null, 'crm_status' => self::MAIL_BOX_STATUS_ACTIVE], ['user_id' => $account['user_id']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
imap_close($mbox);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $mbox;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($account = self::getMailAccountDetail($user)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($account) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = Settings_Mail_Config_Model::getConfig('mailIcon');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$info = imap_status($mbox, static::$imapConnectMailbox, SA_UNSEEN);
- Exclude checks
Line exceeds 120 characters; contains 162 characters Open
$dbCommand->update('u_#__mail_quantities', ['num' => $counter[$user], 'date' => date('Y-m-d H:i:s')], ['userid' => $user])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $th) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $counter;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$maxRetries = $config['imap_max_retries'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function updateMailBoxCounter(array $users): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($all[$user])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$counter[$user] = $all[$user]['num'] ?? 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$msgno) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('cc_email', \App\Purifier::purify($mail->getEmail('cc')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($config['imap_max_retries'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crm_status' => $status,
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$dbCommand->update('u_#__mail_quantities', ['date' => date('Y-m-d H:i:s')], ['userid' => $user])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_msgno', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = imap_uid($mbox, $msgno);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = strtotime("-{$interval} seconds");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$counter = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$msgno) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (property_exists($header, 'message_id')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$messageId = $header->message_id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
});
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($date) || false === strtotime($date)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = date('Y-m-d H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crm_error' => \App\TextUtils::textTruncate($date . '||' . imap_last_error(), 250),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_status|' . $user, 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$counter[$user] = $info->unseen ?? 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('header', $header);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile('OSSMail_Record_Model|imap_close|' . $user, 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = self::MAIL_BOX_STATUS_ACTIVE == $account['crm_status'] ? self::MAIL_BOX_STATUS_INVALID_ACCESS : self::MAIL_BOX_STATUS_BLOCKED_TEMP;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = self::MAIL_BOX_STATUS_BLOCKED_PERM;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['user_id' => $account['user_id']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('u_#__mail_quantities', ['num' => $counter[$user], 'date' => date('Y-m-d H:i:s')], ['userid' => $user])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getMail($mbox, $id, $msgno = false, bool $fullMode = true)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('to_email', \App\Purifier::purify($mail->getEmail('to')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$imapConnectMailbox = "{{$host}:{$port}/imap{$sslMode}{$validateCert}}{$folder}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile('OSSMail_Record_Model|imap_close|' . $user, 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$all = (new \App\Db\Query())->from('u_#__mail_quantities')->where(['userid' => $users])->indexBy('userid')->all();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('u_#__mail_quantities', ['date' => date('Y-m-d H:i:s')], ['userid' => $user])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error($th->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|\OSSMail_Mail_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mbox = imap_open(static::$imapConnectMailbox, $user, $password, $options, $maxRetries, $params);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error($e->getMessage() . PHP_EOL . $e->__toString());
- Exclude checks
Line exceeds 120 characters; contains 188 characters Open
if (self::MAIL_BOX_STATUS_BLOCKED_TEMP === $status && strtotime('-' . (OSSMailScanner_Record_Model::getConfig('blocked')['permanentTime'] ?? '2 day')) > strtotime($date)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update('roundcube_users', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
\App\Log::error('Error OSSMail_Record_Model::imapConnect(' . static::$imapConnectMailbox . '): ' . imap_last_error());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('id', $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('bcc_email', \App\Purifier::purify($mail->getEmail('bcc')));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $mail;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getBodyAttach($mbox, $id, $msgno)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $partNum
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (3 == $partStructure->encoding) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = $config['imap_params'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::trace('imap_open(({' . static::$imapConnectMailbox . ", $user , '****'. $options, $maxRetries, " . var_export($params, true) . ') method ...');
- Exclude checks
Line exceeds 120 characters; contains 161 characters Open
\App\Log::trace('imap_open(({' . static::$imapConnectMailbox . ", $user , '****'. $options, $maxRetries, " . var_export($params, true) . ') method ...');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error('Error OSSMail_Record_Model::imapConnect(' . static::$imapConnectMailbox . '): ' . imap_last_error());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($users as $user) {
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$dbCommand->insert('u_#__mail_quantities', ['userid' => $user, 'num' => 0, 'date' => date('Y-m-d H:i:s')])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_status|' . $user, 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$msgno = imap_msgno($mbox, $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_uid', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_headerinfo', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$header = imap_headerinfo($mbox, $msgno);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_fetch_overview', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return user account detal.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::$usersCache[$userid] = $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$struct = imap_fetchstructure($mbox, $id, FT_UID);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$body = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$attachment = (isset($mail['attachments'])) ? $mail['attachments'] : [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = imap_base64($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::$usersCache[$userid];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\function_exists('mb_convert_encoding') && \in_array($charset, mb_list_encodings())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param resource $mbox
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'body' => $body,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetch_overview', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$clean .= imap_fetchheader($mbox, $msg->msgno);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return .= $row->mailbox . '@' . $row->host;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = ['id' => $id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $orgData = imap_body($mbox, $mail['id'], FT_UID | FT_PEEK);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $text;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($text as $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return body and attachments.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'attachment' => $attachment,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param object $partStructure
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$clean = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text .= iconv($charset, 'UTF-8', $row->text);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = self::initMailPart($mbox, $mail, $struct, 0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Init mail part.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($partNum) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'isHtml' => !empty($mail['textHtml']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static function initMailPart($mbox, $mail, $partStructure, $partNum)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (2 == $partStructure->encoding) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('clean', $clean);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' != $return) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $mail
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $orgData = imap_fetchbody($mbox, $mail['id'], $partNum, FT_UID | FT_PEEK);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (4 == $partStructure->encoding) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('body', $structure['body']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
$user = (new \App\Db\Query())->from('roundcube_users')->where(['user_id' => $userid, 'crm_status' => [self::MAIL_BOX_STATUS_INVALID_ACCESS, self::MAIL_BOX_STATUS_ACTIVE]])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function decodeText($text)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = imap_mime_header_decode($text);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return full name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getFullName($text)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' == $row->personal) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchstructure', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($struct->parts as $partNum => $partStructure) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('subject', isset($header->subject) ? \App\TextUtils::textTruncate(\App\Purifier::purify(self::decodeText($header->subject)), 65535, false) : '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('date', date('Y-m-d H:i:s', $header->udate));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_fetchheader', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
$mail->set('subject', isset($header->subject) ? \App\TextUtils::textTruncate(\App\Purifier::purify(self::decodeText($header->subject)), 65535, false) : '');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$structure = self::getBodyAttach($mbox, $id, $msgno);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('isHtml', $structure['isHtml']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $text
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchbody', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userid
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($data as &$row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($struct->parts)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$body = (!empty($mail['textHtml'])) ? $mail['textHtml'] : $body;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
$mail->set('firstLetterBg', strtoupper(\App\TextUtils::textTruncate(trim(strip_tags(App\Purifier::purify($mail->getEmail('from')))), 1, false)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fullMode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($msgs as $msg) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchheader', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static $usersCache = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = (new \App\Db\Query())->from('roundcube_users')->where(['user_id' => $userid, 'crm_status' => [self::MAIL_BOX_STATUS_INVALID_ACCESS, self::MAIL_BOX_STATUS_ACTIVE]])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Convert text encoding.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$charset = ('default' == $row->charset) ? 'ASCII' : $row->charset;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return .= self::decodeText($row->personal) . ' - ' . $row->mailbox . '@' . $row->host;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_body', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('attachments', $structure['attachment']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Users cache.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(self::$usersCache[$userid])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return .= ',';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $msgno
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_fetchstructure', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = self::initMailPart($mbox, $mail, $partStructure, $partNum + 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$body = (!empty($mail['textPlain'])) ? $mail['textPlain'] : $body;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 == $partStructure->encoding) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getMailAccountDetail($userid)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text .= mb_convert_encoding($row->text, 'utf-8', $charset);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $text
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param resource $mbox
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = imap_utf8($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = imap_binary($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail->set('firstLetterBg', strtoupper(\App\TextUtils::textTruncate(trim(strip_tags(App\Purifier::purify($mail->getEmail('from')))), 1, false)));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$msgs = imap_fetch_overview($mbox, $msgno);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($params['charset']) && 'utf-8' !== strtolower($params['charset'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$encodedData = mb_convert_encoding($data, 'UTF-8', $params['charset']);
- Exclude checks
Line exceeds 120 characters; contains 201 characters Open
$attachmentId = $partStructure->ifid ? trim($partStructure->id, ' <>') : (isset($params['filename']) || isset($params['name']) ? random_int(0, PHP_INT_MAX) . random_int(0, PHP_INT_MAX) : null);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match('/^([a-zA-Z0-9]{76} )+[a-zA-Z0-9]{76}$/', $data) && base64_decode($data, true)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['textPlain'] = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while (preg_match($uu_regexp_begin, $input, $matches, PREG_OFFSET_CAPTURE)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($q = strspn($line, '>')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[strtolower($param->attribute)] = $param->value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($partStructure->dparameters as $param) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $encodedData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($params['format']) && 'flowed' === $params['format']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($mail['textHtml'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filebody = str_replace("\r\n", "\n", $filebody);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'filename' => trim($matches[1][0]),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($text[$idx]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = imap_qprint($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$paramName] .= $param->value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fileName = !empty($params['filename']) ? $params['filename'] : $params['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (2 == $partStructure->type && $data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$line = substr($line, $q);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($delSp) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$paramName] = $param->value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['attachments'][$attachmentId]['attachment'] = $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $input
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static function unfoldFlowed(string $text, bool $delSp = false): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('-- ' == $line) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fileName = self::decodeText($fileName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['textPlain'] .= $uuDecode['text'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $orgData;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$qLevel = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($uuDecode['attachments'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($mail['textPlain'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['textPlain'] .= trim($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$attachments = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($partStructure->dparameters)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($params[$paramName])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['textPlain'] = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $mail;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startpos = $matches[0][1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// extract attachment body
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$input = substr_replace($input, '', $startpos, $endpos + $end_len - $startpos);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$encodedData = iconv($params['charset'], 'UTF-8', $data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['attachments'] = $uuDecode['attachments'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($partStructure->parts)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Parse format=flowed message body.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $text
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& isset($text[$last]) && ' ' == $text[$last][\strlen($text[$last]) - 1]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($encodedData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fileName = self::decodeRFC2231($fileName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($mail['textPlain'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($partStructure->parameters as $param) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($data && '<' !== $data[0] && '<' === $orgData[0]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static function uuDecode($input)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$attachments[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($text as $idx => $line) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = $idx;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($partStructure->parameters)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['attachments'][$attachmentId]['filename'] = $fileName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (0 == $partStructure->type && $data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['textHtml'] .= $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$end_len = \strlen($m[0][0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// remove attachment body from the message body
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $delSp
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text = preg_split('/\r?\n/', $text);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = -1;
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$paramName = strtolower(preg_match('~^(.*?)\*~', $param->attribute, $matches) ? $matches[1] : $param->attribute);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$attachmentId = $partStructure->ifid ? trim($partStructure->id, ' <>') : (isset($params['filename']) || isset($params['name']) ? random_int(0, PHP_INT_MAX) . random_int(0, PHP_INT_MAX) : null);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($attachmentId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($params['filename']) && empty($params['name'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$begin_len = \strlen($matches[0][0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (2 == $partStructure->type && 'RFC822' == $partStructure->subtype) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'attachment' => convert_uudecode($filebody),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!preg_match($uu_regexp_end, $input, $m, PREG_OFFSET_CAPTURE, $startpos)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$endpos = $m[0][1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$line = substr($line, 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& !preg_match('/^>+ {0,1}$/', $text[$last])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$paramName = strtolower(preg_match('~^(.*?)\*~', $param->attribute, $matches) ? $matches[1] : $param->attribute);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\function_exists('mb_convert_encoding') && \in_array($params['charset'], mb_list_encodings())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = base64_decode($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$uuDecode = self::uuDecode($data);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$uuDecode['text'] = self::unfoldFlowed($uuDecode['text'], isset($params['delsp']) && 'yes' === strtolower($params['delsp']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// add attachments to the structure
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['attachments' => $attachments, 'text' => $input];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($line[0]) && ' ' === $line[0]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text[$last] = substr($text[$last], 0, -1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text[$last] .= $line;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fileName = $attachmentId . '.' . strtolower($partStructure->subtype);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail['textHtml'] = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($partStructure->parts as $subPartNum => $subPartStructure) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = self::initMailPart($mbox, $mail, $subPartStructure, $partNum);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Decode string.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$filebody = substr($input, $startpos + $begin_len, $endpos - $startpos - $begin_len - 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('plain' == strtolower($partStructure->subtype)) {
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
$uuDecode['text'] = self::unfoldFlowed($uuDecode['text'], isset($params['delsp']) && 'yes' === strtolower($params['delsp']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = self::initMailPart($mbox, $mail, $subPartStructure, $partNum . '.' . ($subPartNum + 1));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($q == $qLevel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text[$last] .= $line;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($list as $mailboxname) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $site_URL;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($accounts) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mailLimit = $numMessages;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& '-- ' !== $text[$last]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& isset($text[$last][\strlen($text[$last]) - 1]) && ' ' === $text[$last][\strlen($text[$last]) - 1]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = $matches[2];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 175 characters Open
$imap = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', true, [], $account);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get mail account detail by hash ID.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($line[0]) && ' ' === $line[0]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::isUrlEncoded($data)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $folders;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getSiteUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($text[$idx]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$site_URL = App\Config::main('site_URL');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mail = self::getMail($imap, false, $i);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$account = reset($account);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = \App\Utils::convertCharacterEncoding($name, 'UTF7-IMAP', 'UTF-8');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return site URL.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('/' != substr($site_URL, -1)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($user && isset($accounts[$user])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mails[] = $mail;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $hash
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($text[$last]) && $line && !$qLevel
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
&& isset($text[$last][\strlen($text[$last]) - 1]) && ' ' === $text[$last][\strlen($text[$last]) - 1]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($delSp) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$string = str_replace('%20', '+', $string);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $decoded != $string && urlencode($decoded) == $string;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $string;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Fetch mails from IMAP.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mailLimit = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$account = reset($accounts);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$imap = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', true, [], $account);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
for ($i = $numMessages; $i > ($numMessages - $mailLimit); --$i) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAccountByHash($hash)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match('/^[_a-zA-Z0-9.,]+$/', $hash)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update user data for account.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$decoded = urldecode($string);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $user
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $mails;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('roundcube_users')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $result;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = $idx;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return implode("\r\n", $text);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected static function decodeRFC2231($string, $charset = 'utf-8')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$folders = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$site_URL = $site_URL . '/';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($result) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Db::getInstance()->createCommand()->update('roundcube_users', $data, ['user_id' => $userId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$last = $idx;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$line = substr($line, 1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* decode RFC2231 formatted string.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$folders = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($mbox) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$ref = '{' . $account['mail_host'] . '}';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = str_replace($ref, '', $mailboxname);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getMailsFromIMAP(?int $user = null)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if url is encoded.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getFolders($user)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$list = imap_list($mbox, $ref, '*');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accounts = self::getAccountsList(false, true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$qLevel = $q;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$numMessages = imap_num_msg($imap);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($numMessages < $mailLimit) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $charset
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (preg_match("/^(.*?)'.*?'(.*?)$/", $string, $matches)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return user folders.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$folders[$name] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mails = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$account = $accounts[$user];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::beginProfile(__METHOD__ . '|imap_num_msg', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['like', 'preferences', "%:\"$hash\";%", false])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$encoding = $matches[1];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $userId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$string = iconv(strtoupper($encoding), $charset, urldecode($data));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
return \App\Db::getInstance()->createCommand()->update('roundcube_users', $data, ['user_id' => $userId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text[$last] = substr($text[$last], 0, -1);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$text[$idx] = $line;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isUrlEncoded($string)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$account = self::getAccountsList($user);
- Exclude checks
Line exceeds 120 characters; contains 172 characters Open
$mbox = self::imapConnect($account['username'], \App\Encryption::getInstance()->decrypt($account['password']), $account['mail_host'], 'INBOX', false, [], $account);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function setAccountUserData(int $userId, array $data): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $data
- Exclude checks
Class name "OSSMail_Record_Model" is not in camel caps format Open
class OSSMail_Record_Model extends Vtiger_Record_Model
- Exclude checks
The variable $begin_len is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $site_URL is not named in camelCase. Open
public static function getSiteUrl()
{
$site_URL = App\Config::main('site_URL');
if ('/' != substr($site_URL, -1)) {
$site_URL = $site_URL . '/';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $site_URL is not named in camelCase. Open
public static function getSiteUrl()
{
$site_URL = App\Config::main('site_URL');
if ('/' != substr($site_URL, -1)) {
$site_URL = $site_URL . '/';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $begin_len is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $uu_regexp_begin is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $uu_regexp_begin is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $site_URL is not named in camelCase. Open
public static function getSiteUrl()
{
$site_URL = App\Config::main('site_URL');
if ('/' != substr($site_URL, -1)) {
$site_URL = $site_URL . '/';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $uu_regexp_end is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $end_len is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $site_URL is not named in camelCase. Open
public static function getSiteUrl()
{
$site_URL = App\Config::main('site_URL');
if ('/' != substr($site_URL, -1)) {
$site_URL = $site_URL . '/';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $uu_regexp_end is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $end_len is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $begin_len is not named in camelCase. Open
protected static function uuDecode($input)
{
$attachments = [];
$uu_regexp_begin = '/begin [0-7]{3,4} ([^\r\n]+)\r?\n/s';
$uu_regexp_end = '/`\r?\nend((\r?\n)|($))/s';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $site_URL is not named in camelCase. Open
public static function getSiteUrl()
{
$site_URL = App\Config::main('site_URL');
if ('/' != substr($site_URL, -1)) {
$site_URL = $site_URL . '/';
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}