The method Mailer::send() calls the typical debug function print_r() which is mostly only used during development. Open
$toAddresses = $this->mailer->From . ' >> ' . \print_r($this->mailer->getToAddresses(), true);
- Read upRead up
- Exclude checks
DevelopmentCodeFragment
Since: 2.3.0
Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.
Example
class SuspectCode {
public function doSomething(array $items)
{
foreach ($items as $i => $item) {
// …
if ('qafoo' == $item) var_dump($i);
// …
}
}
}
Source https://phpmd.org/rules/design.html#developmentcodefragment
The method Mailer::send() calls the typical debug function print_r() which is mostly only used during development. Open
Log::error('Mailer Error: ' . \print_r($this->mailer->ErrorInfo, true), 'Mailer');
- Read upRead up
- Exclude checks
DevelopmentCodeFragment
Since: 2.3.0
Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.
Example
class SuspectCode {
public function doSomething(array $items)
{
foreach ($items as $i => $item) {
// …
if ('qafoo' == $item) var_dump($i);
// …
}
}
}
Source https://phpmd.org/rules/design.html#developmentcodefragment
File Mailer.php
has 472 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace App;
/**
Function sendByRowQueue
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
public static function sendByRowQueue($rowQueue)
{
if ('demo' === \App\Config::main('systemMode')) {
return true;
}
- 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 setSmtp
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function setSmtp(): void
{
if (!$this->smtp) {
throw new \App\Exceptions\AppException('ERR_NO_SMTP_CONFIGURATION');
}
- 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 class Mailer has 19 public methods. Consider refactoring Mailer to keep number of public methods under 10. Open
class Mailer
{
/** @var string[] Queue status */
public static $statuses = [
0 => 'LBL_PENDING_ACCEPTANCE',
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class Mailer has an overall complexity of 111 which is very high. The configured complexity threshold is 50. Open
class Mailer
{
/** @var string[] Queue status */
public static $statuses = [
0 => 'LBL_PENDING_ACCEPTANCE',
- Exclude checks
Method sendByRowQueue
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendByRowQueue($rowQueue)
{
if ('demo' === \App\Config::main('systemMode')) {
return true;
}
Method setSmtp
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setSmtp(): void
{
if (!$this->smtp) {
throw new \App\Exceptions\AppException('ERR_NO_SMTP_CONFIGURATION');
}
Mailer
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Mailer
{
/** @var string[] Queue status */
public static $statuses = [
0 => 'LBL_PENDING_ACCEPTANCE',
Method sendFromTemplate
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function sendFromTemplate(array $params): bool
{
Log::trace('Send mail from template', 'Mailer');
if (empty($params['template'])) {
Log::warning('No template', 'Mailer');
Function sendFromTemplate
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function sendFromTemplate(array $params): bool
{
Log::trace('Send mail from template', 'Mailer');
if (empty($params['template'])) {
Log::warning('No template', 'Mailer');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method addMail
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function addMail(array $params): bool
{
$params['status'] = Config::component('Mail', 'MAILER_REQUIRED_ACCEPTATION_BEFORE_SENDING') ? 0 : 1;
$params['date'] = date('Y-m-d H:i:s');
if (empty($params['owner'])) {
Method send
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send(): bool
{
$eventHandler = new EventHandler();
$eventHandler->setParams(['mailer' => $this]);
$eventHandler->trigger('MailerBeforeSend');
Function send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function send(): bool
{
$eventHandler = new EventHandler();
$eventHandler->setParams(['mailer' => $this]);
$eventHandler->trigger('MailerBeforeSend');
- 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 insertMail
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function insertMail(array $params, string $type): void
{
$eventHandler = new EventHandler();
$eventHandler->setParams($params);
$eventHandler->trigger('admin' === $type ? 'MailerAddToQueue' : 'MailerAddToLogs');
- 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 setSmtp() has an NPath complexity of 49920. The configured NPath complexity threshold is 200. Open
public function setSmtp(): void
{
if (!$this->smtp) {
throw new \App\Exceptions\AppException('ERR_NO_SMTP_CONFIGURATION');
}
- 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 sendFromTemplate() has an NPath complexity of 1728. The configured NPath complexity threshold is 200. Open
public static function sendFromTemplate(array $params): bool
{
Log::trace('Send mail from template', 'Mailer');
if (empty($params['template'])) {
Log::warning('No template', 'Mailer');
- 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 sendByRowQueue() has an NPath complexity of 15840. The configured NPath complexity threshold is 200. Open
public static function sendByRowQueue($rowQueue)
{
if ('demo' === \App\Config::main('systemMode')) {
return true;
}
- 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 setSmtp() has a Cyclomatic Complexity of 24. The configured cyclomatic complexity threshold is 10. Open
public function setSmtp(): void
{
if (!$this->smtp) {
throw new \App\Exceptions\AppException('ERR_NO_SMTP_CONFIGURATION');
}
- 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 sendByRowQueue() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10. Open
public static function sendByRowQueue($rowQueue)
{
if ('demo' === \App\Config::main('systemMode')) {
return true;
}
- 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 sendFromTemplate() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public static function sendFromTemplate(array $params): bool
{
Log::trace('Send mail from template', 'Mailer');
if (empty($params['template'])) {
Log::warning('No template', 'Mailer');
- 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 45 to the 15 allowed. Open
public static function sendByRowQueue($rowQueue)
- 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
Reduce the number of returns of this function 4, down to the maximum allowed 3. Open
public static function addMail(array $params): bool
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed. Open
public function setSmtp(): void
- 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
Class "Mailer" has 23 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Mailer
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
The class Mailer has a coupling between objects value of 19. Consider to reduce the number of dependencies under 13. Open
class Mailer
{
/** @var string[] Queue status */
public static $statuses = [
0 => 'LBL_PENDING_ACCEPTANCE',
- 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
Missing class import via use statement (line '48', column '23'). Open
$this->mailer = new \PHPMailer\PHPMailer\PHPMailer(false);
- 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 '236', column '14'). Open
throw new \App\Exceptions\AppException('ERR_NO_SMTP_CONFIGURATION');
- 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
Avoid using static access to class '\App\Mail' in method 'addMail'. Open
if (!\App\Mail::getSmtpById($params['smtp_id'])) {
- 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 'send'. Open
\App\Log::endProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- 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\Mail' in method 'addMail'. Open
$params['smtp_id'] = Mail::getDefaultSmtp();
- 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 '__construct'. Open
Log::error(trim($str), 'Mailer');
- 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\User' in method 'addMail'. Open
$owner = User::getCurrentUserRealId();
- 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 'addMail'. Open
Log::warning('No target email address provided', 'Mailer');
- 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\Mail' in method 'loadSmtpByID'. Open
$this->smtp = Mail::getSmtpById($smtpId);
- 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\TextParser' in method 'sendFromTemplate'. Open
$textParser = $recordModel ? TextParser::getInstanceByModel($recordModel) : TextParser::getInstance($params['moduleName'] ?? '');
- 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 'addMail'. Open
Log::warning('No SMTP configuration', 'Mailer');
- 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 'test'. Open
Log::error(trim($str), 'Mailer');
- 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 'test'. Open
Log::trace(trim($str), 'Mailer');
- 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\Mail' in method 'test'. Open
$templateId = Mail::getTemplateIdFromSysName('TestMailAboutTheMailServerConfiguration');
- 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 'sendFromTemplate'. Open
Log::warning('No template', 'Mailer');
- 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 'sendFromTemplate'. Open
Log::warning('No mail template', 'Mailer');
- 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\Json' in method 'setSmtp'. Open
foreach (\App\Json::decode($this->smtp['unsubscribe']) as $row) {
- 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\YetiForce\Shop' in method 'content'. Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- 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 'send'. Open
\App\Log::beginProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- 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 '__construct'. Open
Log::trace(trim($str), 'Mailer');
- 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 'addMail'. Open
Log::warning('SMTP configuration with provided id not exists', 'Mailer');
- 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 test uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
Log::trace(trim($str), 'Mailer');
}
- 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\TextParser' in method 'test'. Open
$textParser = TextParser::getInstanceById($currentUser->getId(), 'Users');
- 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 'sendFromTemplate'. Open
$params['content'] = $textParser->setContent(\App\Utils\Completions::decode(\App\Purifier::purifyHtml($template['content'])))->parse()->getContent();
- 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 '__construct'. Open
$this->mailer->CharSet = \App\Config::main('default_charset');
- 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 'send'. Open
Log::error('Mailer Error: ' . \print_r($this->mailer->ErrorInfo, true), 'Mailer');
- 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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
Log::trace(trim($str), 'Mailer');
}
- 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 'sendFromTemplate'. Open
Log::trace('Send mail from template', 'Mailer');
- 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 'send'. Open
Log::trace('Mailer sent mail', 'Mailer');
- 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\Language' in method 'test'. Open
return ['result' => false, 'error' => Language::translate('LBL_NO_EMAIL_TEMPLATE')];
- 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 '__construct'. Open
if (\App\Config::debug('MAILER_DEBUG')) {
- 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\TextParser' in method 'sendFromTemplate'. Open
$textParser = $recordModel ? TextParser::getInstanceByModel($recordModel) : TextParser::getInstance($params['moduleName'] ?? '');
- 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\Completions' in method 'sendFromTemplate'. Open
$params['content'] = $textParser->setContent(\App\Utils\Completions::decode(\App\Purifier::purifyHtml($template['content'])))->parse()->getContent();
- 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\Json' in method 'setSmtp'. Open
$this->mailer->SMTPOptions = Json::decode($this->smtp['options'], true);
- 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\Mail' in method 'test'. Open
$template = Mail::getTemplate($templateId);
- 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\Mail' in method 'sendFromTemplate'. Open
$template = Mail::getTemplate($params['template']);
- 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\Json' in method 'insertMail'. Open
$params[$key] = Json::encode($params[$key]);
- 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 'send'. Open
\App\Log::endProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- 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 send uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
static::$error[] = $this->mailer->ErrorInfo;
}
- 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 '\Users_Record_Model' in method 'test'. Open
$currentUser = \Users_Record_Model::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
Avoid using static access to class '\Vtiger_Record_Model' in method 'sendFromTemplate'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById($params['recordId'], $moduleName);
- 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 sendFromTemplate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$recordModel = $params['recordModel'];
unset($params['recordModel']);
}
- 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\Config' in method 'addMail'. Open
$params['status'] = Config::component('Mail', 'MAILER_REQUIRED_ACCEPTATION_BEFORE_SENDING') ? 0 : 1;
- 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\Json' in method 'sendByRowQueue'. Open
$attachments = Json::decode($rowQueue['attachments']);
- 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 '\OSSMail_Record_Model' in method 'saveMail'. Open
$mbox = \OSSMail_Record_Model::imapConnect(
$this->smtp['smtp_username'],
Encryption::getInstance()->decrypt($this->smtp['smtp_password']),
$this->smtp['smtp_host'] . ':' . $this->smtp['smtp_port'], $folder, 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\Json' in method 'sendByRowQueue'. Open
foreach (Json::decode($rowQueue[$key]) as $email => $name) {
- 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 'saveMail'. Open
Log::error('Mailer Error: No smtp data entered', 'Mailer');
- 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\Json' in method 'sendByRowQueue'. Open
$from = Json::decode($rowQueue['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 'saveMail'. Open
\App\Log::beginProfile(__METHOD__ . '|imap_append', '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 'sendByRowQueue'. Open
if ('demo' === \App\Config::main('systemMode')) {
- 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 'saveMail'. Open
\App\Log::endProfile(__METHOD__ . '|imap_append', '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 sendByRowQueue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$update['status'] = 2;
$update['error'] = implode(PHP_EOL, static::$error);
$db->createCommand()->update('s_#__mail_queue', $update, ['id' => $rowQueue['id']])->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 'saveMail'. Open
Log::error('Mailer Error: IMAP error - ' . imap_last_error(), 'Mailer');
- 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 sendByRowQueue uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
foreach (Json::decode($rowQueue['to']) as $email => $name) {
if (is_numeric($email)) {
$email = $name;
$name = '';
- 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\Utils' in method 'saveMail'. Open
$folder = Utils::convertCharacterEncoding($this->smtp['smtp_folder'], 'UTF-8', 'UTF7-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\Mail' in method 'sendByRowQueue'. Open
$attachments = array_merge($attachments, Mail::getAttachmentsFromDocument($attachments['ids']));
- 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\Json' in method 'sendByRowQueue'. Open
foreach (Json::decode($rowQueue['to']) as $email => $name) {
- 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\Db' in method 'sendByRowQueue'. Open
$db = Db::getInstance('admin');
- 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\Json' in method 'sendByRowQueue'. Open
foreach (Json::decode($rowQueue['to']) as $email => $name) {
- 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\Json' in method 'sendByRowQueue'. Open
$update['to'] = Json::encode($emails);
- 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\Json' in method 'sendByRowQueue'. Open
$mailer->setCustomParams(Json::decode($rowQueue['params']));
- 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
Define a constant instead of duplicating this literal "content" 6 times. Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- 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|SMTP" 3 times. Open
\App\Log::beginProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- 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 "params" 5 times. Open
public static $quoteJsonColumn = ['from', 'to', 'cc', 'bcc', 'attachments', 'params'];
- 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 "smtp_id" 10 times. Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- 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 "priority" 7 times. Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- 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 "admin" 4 times. Open
static::insertMail($params, 'admin');
- 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 "error" 5 times. Open
if (false !== stripos($str, 'error') || false !== stripos($str, 'failed')) {
- 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 "error_code" 3 times. Open
$params['error_code'] = 1;
- 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 "owner" 3 times. Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- 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 "Mailer" 14 times. Open
Log::error(trim($str), 'Mailer');
- 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 "subject" 7 times. Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- 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" 10 times. Open
public static $quoteJsonColumn = ['from', 'to', 'cc', 'bcc', 'attachments', 'params'];
- 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 "recordModel" 4 times. Open
if (empty($params['recordModel'])) {
- 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.
Remove the unused function parameter "$level". Open
$this->mailer->Debugoutput = function ($str, $level) {
- Read upRead up
- Exclude checks
Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.
Noncompliant Code Example
function doSomething($a, $b) { // "$a" is unused return compute($b); }
Compliant Solution
function doSomething($b) { return compute($b); }
Exceptions
Functions in classes that override a class or implement interfaces are ignored.
class C extends B { function doSomething($a, $b) { // no issue reported on $b compute($a); } }
See
- MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
- MISRA C:2012, 2.7 - There should be no unused parameters in functions
- CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
- CERT, MSC12-CPP. - Detect and remove code that has no effect
Define a constant instead of duplicating this literal "status" 6 times. Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- 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.
Remove the unused function parameter "$level". Open
$this->mailer->Debugoutput = function ($str, $level) {
- Read upRead up
- Exclude checks
Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.
Noncompliant Code Example
function doSomething($a, $b) { // "$a" is unused return compute($b); }
Compliant Solution
function doSomething($b) { return compute($b); }
Exceptions
Functions in classes that override a class or implement interfaces are ignored.
class C extends B { function doSomething($a, $b) { // no issue reported on $b compute($a); } }
See
- MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
- MISRA C:2012, 2.7 - There should be no unused parameters in functions
- CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
- CERT, MSC12-CPP. - Detect and remove code that has no effect
Add a "case default" clause to this "switch" statement. Open
switch ($this->smtp['priority']) {
- Read upRead up
- Exclude checks
The requirement for a final case default
clause is defensive programming. The clause should either take appropriate action, or contain
a suitable comment as to why no action is taken. Even when the switch
covers all current values of an enum
, a default case
should still be used because there is no guarantee that the enum
won't be extended.
Noncompliant Code Example
switch ($param) { //missing default clause case 0: do_something(); break; case 1: do_something_else(); break; } switch ($param) { default: // default clause should be the last one error(); break; case 0: do_something(); break; case 1: do_something_else(); break; }
Compliant Solution
switch ($param) { case 0: do_something(); break; case 1: do_something_else(); break; default: error(); break; }
See
- MISRA C:2004, 15.0 - The MISRA C switch syntax shall be used.
- MISRA C:2004, 15.3 - The final clause of a switch statement shall be the default clause
- MISRA C++:2008, 6-4-3 - A switch statement shall be a well-formed switch statement.
- MISRA C++:2008, 6-4-6 - The final clause of a switch statement shall be the default-clause
- MISRA C:2012, 16.1 - All switch statements shall be well-formed
- MISRA C:2012, 16.4 - Every switch statement shall have a default label
- MISRA C:2012, 16.5 - A default label shall appear as either the first or the last switch label of a switch statement
- MITRE, CWE-478 - Missing Default Case in Switch Statement
- CERT, MSC01-C. - Strive for logical completeness
- CERT, MSC01-CPP. - Strive for logical completeness
Define a constant instead of duplicating this literal "s_#__mail_queue" 3 times. Open
\App\Db::getInstance($type)->createCommand()->insert('admin' === $type ? 's_#__mail_queue' : 'l_#__mail', $params)->execute();
- 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 parameters such as '$level'. Open
$this->mailer->Debugoutput = function ($str, $level) {
- 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 parameters such as '$level'. Open
$this->mailer->Debugoutput = function ($str, $level) {
- 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
Reference to instance property Debugoutput
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Debugoutput = function ($str, $level) {
- Exclude checks
Call to method decode
from undeclared class \App\Utils\Completions
Open
$params['content'] = $textParser->setContent(\App\Utils\Completions::decode(\App\Purifier::purifyHtml($template['content'])))->parse()->getContent();
- Exclude checks
Call to method AddCustomHeader
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->AddCustomHeader('List-Unsubscribe', $unsubscribe);
- Exclude checks
Reference to instance property Subject
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->params['subject'] = $this->mailer->Subject = $subject;
- Exclude checks
Call to method addCC
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->addCC($address, $name);
- Exclude checks
Call to method getToAddresses
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$toAddresses = $this->mailer->From . ' >> ' . \print_r($this->mailer->getToAddresses(), true);
- Exclude checks
Call to method getInstance
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
Encryption::getInstance()->decrypt($this->smtp['smtp_password']),
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
Log::warning('No SMTP configuration', 'Mailer');
- Exclude checks
Reference to instance property From
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->From = $this->smtp['from_email'] ?: $this->smtp['username'];
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error('Mailer Error: ' . \print_r($this->mailer->ErrorInfo, true), 'Mailer');
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
Log::warning('No mail template', 'Mailer');
- Exclude checks
Argument 2 (objectDecodeType)
is true
but \App\Json::decode()
takes int
defined at /code/app/Json.php:37
Open
$this->mailer->SMTPOptions = Json::decode($this->smtp['options'], true);
- Exclude checks
Call to method addReplyTo
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->addReplyTo($this->smtp['reply_to']);
- Exclude checks
Call to method AddCustomHeader
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->AddCustomHeader('Importance', $priorityName);
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile(__METHOD__ . '|imap_append', 'Mail|IMAP');
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
Log::warning('No target email address provided', 'Mailer');
- Exclude checks
Reference to instance property ConfirmReadingTo
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->ConfirmReadingTo = $this->smtp['confirm_reading_to'];
- Exclude checks
Call to method msgHTML
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->msgHTML($message);
- Exclude checks
Reference to instance property Ical
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Ical = $this->params['ics'];
- Exclude checks
Reference to instance property Host
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Host = $this->smtp['host'];
- Exclude checks
Call to method getInstance
from undeclared class \App\Encryption
(Did you mean class \Tests\App\Encryption) Open
$this->mailer->Password = trim(Encryption::getInstance()->decrypt($this->smtp['password']));
- Exclude checks
Call to method AddCustomHeader
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->AddCustomHeader('Priority', $priority);
- Exclude checks
Reference to instance property FromName
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->FromName = $name;
- Exclude checks
Call to method addAddress
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->addAddress($address, $name);
- Exclude checks
Call to method beginProfile
from undeclared class \App\Log
Open
\App\Log::beginProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- Exclude checks
Reference to instance property Hostname
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Hostname = 'YetiForceCRM';
- Exclude checks
Call to method getSentMIMEMessage
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
imap_append($mbox, \OSSMail_Record_Model::$imapConnectMailbox, $this->mailer->getSentMIMEMessage(), '\\Seen');
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error(trim($str), 'Mailer');
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
Log::warning('SMTP configuration with provided id not exists', 'Mailer');
- Exclude checks
Call to method isQmail
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->isQmail();
- Exclude checks
Reference to instance property SMTPSecure
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->SMTPSecure = $this->smtp['secure'];
- Exclude checks
Call to method AddCustomHeader
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->AddCustomHeader('Organization', $this->smtp['organization']);
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- Exclude checks
Property \App\Mailer->mailer
has undeclared type \PHPMailer\PHPMailer\PHPMailer
Open
protected $mailer;
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
Log::trace(trim($str), 'Mailer');
- Exclude checks
Reference to instance property FromName
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->FromName = 'YetiForce Mailer';
- Exclude checks
Reference to instance property CharSet
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->CharSet = \App\Config::main('default_charset');
- Exclude checks
Call to method getInstanceByModel
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
$textParser = $recordModel ? TextParser::getInstanceByModel($recordModel) : TextParser::getInstance($params['moduleName'] ?? '');
- Exclude checks
Reference to instance property Password
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Password = trim(Encryption::getInstance()->decrypt($this->smtp['password']));
- Exclude checks
Call to method addBCC
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->addBCC($address, $name);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->delete('s_#__mail_queue', ['id' => $rowQueue['id']])->execute();
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
Log::trace('Send mail from template', 'Mailer');
- Exclude checks
Reference to instance property Port
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Port = $this->smtp['port'];
- Exclude checks
Reference to instance property Username
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Username = trim($this->smtp['username']);
- Exclude checks
Reference to instance property From
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$toAddresses = $this->mailer->From . ' >> ' . \print_r($this->mailer->getToAddresses(), true);
- Exclude checks
Call to method send
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
if ($this->mailer->send()) {
- Exclude checks
Reference to instance property ErrorInfo
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
if (\is_array($this->mailer->ErrorInfo)) {
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error(trim($str), 'Mailer');
- Exclude checks
Call to method __construct
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer = new \PHPMailer\PHPMailer\PHPMailer(false);
- Exclude checks
Reference to instance property XMailer
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->XMailer = 'YetiForceCRM Mailer';
- Exclude checks
Parameter $message
has undeclared type \App\text
Open
public function content($message)
- Exclude checks
Reference to instance property From
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->From = $address;
- Exclude checks
Call to method addReplyTo
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->addReplyTo($address, $name);
- Exclude checks
Call to method addAttachment
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->addAttachment($path, $name);
- Exclude checks
Reference to instance property ErrorInfo
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
static::$error[] = $this->mailer->ErrorInfo;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance($type)->createCommand()->insert('admin' === $type ? 's_#__mail_queue' : 'l_#__mail', $params)->execute();
- Exclude checks
Call to method isSendmail
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->isSendmail();
- Exclude checks
Reference to instance property SMTPAuth
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->SMTPAuth = isset($this->smtp['authentication']) && (bool) $this->smtp['authentication'];
- Exclude checks
Reference to instance property Debugoutput
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Debugoutput = function ($str, $level) {
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
Log::trace(trim($str), 'Mailer');
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error('Mailer Error: IMAP error - ' . imap_last_error(), 'Mailer');
- Exclude checks
Reference to instance property SMTPDebug
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->SMTPDebug = 2;
- Exclude checks
Call to method getInstance
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
$textParser = $recordModel ? TextParser::getInstanceByModel($recordModel) : TextParser::getInstance($params['moduleName'] ?? '');
- Exclude checks
Call to method getCurrentUserRealId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$owner = User::getCurrentUserRealId();
- Exclude checks
Call to method isMail
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->isMail();
- Exclude checks
Call to method AddCustomHeader
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->AddCustomHeader('X-MSMail-Priority', $priorityName);
- Exclude checks
Call to method check
from undeclared class \App\YetiForce\Shop
Open
if (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- Exclude checks
Call to method getInstanceById
from undeclared class \App\TextParser
(Did you mean class \Tests\App\TextParser) Open
$textParser = TextParser::getInstanceById($currentUser->getId(), 'Users');
- Exclude checks
Argument 1 (stream_id)
is \IMAP\Connection|false
but \imap_append()
takes resource
Open
imap_append($mbox, \OSSMail_Record_Model::$imapConnectMailbox, $this->mailer->getSentMIMEMessage(), '\\Seen');
- Exclude checks
Call to method trace
from undeclared class \App\Log
Open
Log::trace('Mailer sent mail', 'Mailer');
- Exclude checks
Reference to instance property ErrorInfo
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
Log::error('Mailer Error: ' . \print_r($this->mailer->ErrorInfo, true), 'Mailer');
- Exclude checks
Reference to instance property ErrorInfo
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
foreach ($this->mailer->ErrorInfo as $error) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('s_#__mail_queue', $update, ['id' => $rowQueue['id']])->execute();
- Exclude checks
Reference to instance property SMTPOptions
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->SMTPOptions = Json::decode($this->smtp['options'], true);
- Exclude checks
Reference to instance property FromName
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->FromName = $this->smtp['from_name'];
- Exclude checks
Reference to instance property Priority
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->Priority = $priorityX;
- Exclude checks
Reference to instance property SMTPDebug
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->SMTPDebug = 2;
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile(__METHOD__ . '|imap_append', 'Mail|IMAP');
- Exclude checks
Call to method isSMTP
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->isSMTP();
- Exclude checks
Call to method isHTML
from undeclared class \PHPMailer\PHPMailer\PHPMailer
Open
$this->mailer->isHTML(true);
- Exclude checks
Call to method endProfile
from undeclared class \App\Log
Open
\App\Log::endProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- Exclude checks
Call to method error
from undeclared class \App\Log
Open
Log::error('Mailer Error: No smtp data entered', 'Mailer');
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
Log::warning('No template', 'Mailer');
- Exclude checks
Avoid using short method names like Mailer::cc(). The configured minimum method name length is 3. Open
public function cc($address, $name = '')
{
$this->params['cc'][$address] = $name;
$this->mailer->addCC($address, $name);
return $this;
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid using short method names like Mailer::to(). The configured minimum method name length is 3. Open
public function to($address, $name = '')
{
$this->params['to'][$address] = $name;
$this->mailer->addAddress($address, $name);
return $this;
- Read upRead up
- Exclude checks
ShortMethodName
Since: 0.2
Detects when very short method names are used.
Example
class ShortMethod {
public function a( $index ) { // Violation
}
}
Source https://phpmd.org/rules/naming.html#shortmethodname
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = Db::getInstance('admin');
- 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
Only one argument is allowed per line in a multi-line function call Open
$this->smtp['smtp_host'] . ':' . $this->smtp['smtp_port'], $folder, false,
- Exclude checks
Only one argument is allowed per line in a multi-line function call Open
$this->smtp['smtp_host'] . ':' . $this->smtp['smtp_port'], $folder, false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
1 => 'LBL_WAITING_TO_BE_SENT',
- 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 $smtpId Smtp 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
$this->mailer->FromName = 'YetiForce Mailer';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $statuses = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->SMTPDebug = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::error(trim($str), 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function loadSmtpByID($smtpId)
- 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 (false !== stripos($str, 'error') || false !== stripos($str, 'failed')) {
- 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
$this->mailer->CharSet = \App\Config::main('default_charset');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setSmtp();
- 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $smtpInfo
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
0 => 'LBL_PENDING_ACCEPTANCE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $quoteJsonColumn = ['from', 'to', 'cc', 'bcc', 'attachments', 'params'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $mailer;
- 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
/** @var string[] Columns list that require JSON formatting */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var \PHPMailer\PHPMailer\PHPMailer PHPMailer instance */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $params = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Construct.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::trace(trim($str), 'Mailer');
- 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[] Columns list available in the database */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var array SMTP configuration */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- 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
$this->mailer->Hostname = 'YetiForceCRM';
- 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 $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var array Parameters for sending messages */
- 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
$this->smtp = $smtpInfo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var array Error logs */
- 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
static::$error = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$error[] = $str;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer = new \PHPMailer\PHPMailer\PHPMailer(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
$this->smtp = Mail::getSmtpById($smtpId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $params
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string[] Queue status */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
public static $quoteColumn = ['smtp_id', 'date', 'owner', 'status', 'from', 'subject', 'content', 'to', 'cc', 'bcc', 'attachments', 'priority'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->XMailer = 'YetiForceCRM Mailer';
- 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
2 => 'LBL_ERROR_DURING_SENDING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Config::debug('MAILER_DEBUG')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->Debugoutput = function ($str, $level) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Load configuration smtp by id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setSmtp();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- 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 $smtp;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $error;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Load configuration smtp.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function loadSmtp($smtpInfo)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::warning('No mail template', 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['subject'] = $textParser->setContent($template['subject'])->parse()->getContent();
- 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
$params['error_code'] = 2;
- 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
$textParser = $recordModel ? TextParser::getInstanceByModel($recordModel) : TextParser::getInstance($params['moduleName'] ?? '');
- 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
$params['status'] = Config::component('Mail', 'MAILER_REQUIRED_ACCEPTATION_BEFORE_SENDING') ? 0 : 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($params['owner'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($params['priority'], $params['status']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::warning('No target email address provided', 'Mailer');
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
\App\Db::getInstance($type)->createCommand()->insert('admin' === $type ? 's_#__mail_queue' : 'l_#__mail', $params)->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
return $this->smtp[$key];
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$textParser->setSourceRecord($params['sourceRecord'], $params['sourceModule']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['owner'] = $owner ?: 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\App\Mail::getSmtpById($params['smtp_id'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($params['to'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::insertMail($params, 'log');
- 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 (static::$quoteJsonColumn as $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance($type)->createCommand()->insert('admin' === $type ? 's_#__mail_queue' : 'l_#__mail', $params)->execute();
- 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
if (isset($params['recordId'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$textParser->setLanguage($params['language']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$owner = User::getCurrentUserRealId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['smtp_id'] = Mail::getDefaultSmtp();
- 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 function getSmtp(?string $key = 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
case 'smtp':
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$params['attachments'] = array_merge(empty($params['attachments']) ? [] : $params['attachments'], $template['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
$params['error_code'] = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string|null $key
- 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
Log::trace('Send mail from template', 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($params['recordModel'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($params['sourceRecord'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['content'] = $textParser->setContent(\App\Utils\Completions::decode(\App\Purifier::purifyHtml($template['content'])))->parse()->getContent();
- 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
$params[$key] = [$params[$key]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->smtp;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->smtp) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($params['template'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::warning('No template', 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$template = Mail::getTemplate($params['template']);
- 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
$textParser->setParams(array_diff_key($params, array_flip(['subject', 'content', 'attachments', 'recordModel'])));
- 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
$recordModel = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $params['moduleName'] ?? 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
$recordModel = $params['recordModel'];
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
$params['content'] = $textParser->setContent(\App\Utils\Completions::decode(\App\Purifier::purifyHtml($template['content'])))->parse()->getContent();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($textParser);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($template['attachments'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set configuration smtp in mailer.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'sendmail':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById($params['recordId'], $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add mail to quote for send.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function addMail(array $params): 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
if (empty($params['smtp_id'])) {
- 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
$eventHandler->trigger('admin' === $type ? 'MailerAddToQueue' : 'MailerAddToLogs');
- 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 function setSmtp(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($this->smtp['mailer_type']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'mail':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($params['recordModel']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['smtp_id'] = $template['smtp_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
$params['date'] = date('Y-m-d H:i:s');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($params['priority'], $params['status']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::warning('No SMTP configuration', 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\is_array($params[$key])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params[$key] = Json::encode($params[$key]);
- 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('ERR_NO_SMTP_CONFIGURATION');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->isSendmail();
- 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['smtp_id']) && !empty($template['smtp_id'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::insertMail($params, 'log');
- 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 insertMail(array $params, string $type): void
- 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
return false;
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
$textParser = $recordModel ? TextParser::getInstanceByModel($recordModel) : TextParser::getInstance($params['moduleName'] ?? '');
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$textParser->setParams(array_diff_key($params, array_flip(['subject', 'content', 'attachments', 'recordModel'])));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['priority'] = $template['email_template_priority'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['params'] = array_diff_key($params, $row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $params
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::insertMail($params, 'admin');
- 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 $params
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->isSMTP();
- 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
static::insertMail($params, 'log');
- 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
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- 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
$eventHandler->setParams($params);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return mixed
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($key && isset($this->smtp[$key])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$template) {
- 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
$params['attachments'] = array_merge(empty($params['attachments']) ? [] : $params['attachments'], $template['attachments']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = array_intersect_key($params, array_flip(self::$quoteColumn));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type 'admin' | 'log'
- 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
$eventHandler = new EventHandler();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = $eventHandler->getParams();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($params[$key])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get configuration smtp.
- 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
$this->mailer->isMail();
- 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 sendFromTemplate(array $params): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return static::addMail($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
unset($params['priority'], $params['status']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::warning('SMTP configuration with provided id not exists', 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['error_code'] = 3;
- 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
* Save mail data in provided table.
- 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['language'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($template['email_template_priority'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($params['smtp_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
}
- 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 ($this->smtp['reply_to']) {
- 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
$this->mailer->AddCustomHeader('X-MSMail-Priority', $priorityName);
- 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
* Creates a message from an HTML string, making modifications for inline images and backgrounds and creates a plain-text version by converting the HTML.
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
* Creates a message from an HTML string, making modifications for inline images and backgrounds and creates a plain-text version by converting the HTML.
- 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 $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- 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 a "BCC" address.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$unsubscribe = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->smtp['priority']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priorityName = 'Low';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priorityX = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->ConfirmReadingTo = $this->smtp['confirm_reading_to'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->AddCustomHeader('Organization', $this->smtp['organization']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->From = $address;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add a "To" address.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->addAddress($address, $name);
- 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
return $this;
- 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
* @see \PHPMailer::MsgHTML()
- 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 string $address The email address to send to
- 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 ($this->smtp['unsubscribe']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'urgent':
- 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 (!\App\YetiForce\Shop::check('YetiForceDisableBranding')) {
- 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 $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
case 'qmail':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->From = $this->smtp['from_email'] ?: $this->smtp['username'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\App\Json::decode($this->smtp['unsubscribe']) as $row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$unsubscribe = rtrim($unsubscribe, ',');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priorityX = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->Priority = $priorityX;
- 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 function cc($address, $name = '')
- 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
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->SMTPOptions = Json::decode($this->smtp['options'], 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
$this->mailer->AddCustomHeader('List-Unsubscribe', $unsubscribe);
- 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
$this->mailer->AddCustomHeader('Importance', $priorityName);
- 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 text $message
- Exclude checks
Line exceeds 120 characters; contains 178 characters Open
$message .= '<table style="font-size:9px;width:100%; margin: 0;"><tbody><tr><td style="width:50%;text-align: center;">Powered by YetiForce</td></tr></tbody></table>';
- 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
$this->params['cc'][$address] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->SMTPAuth = isset($this->smtp['authentication']) && (bool) $this->smtp['authentication'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->Password = trim(Encryption::getInstance()->decrypt($this->smtp['password']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priorityName = 'High';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set subject.
- 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
$this->mailer->FromName = $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
$this->mailer->Username = trim($this->smtp['username']);
- 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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$message .= '<table style="font-size:9px;width:100%; margin: 0;"><tbody><tr><td style="width:50%;text-align: center;">Powered by YetiForce</td></tr></tbody></table>';
- 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 $this mailer object itself
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- 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
$this->mailer->addCC($address, $name);
- 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
if ($this->smtp['organization']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function subject($subject)
- 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
* Set the From and FromName properties.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priorityName = $priority = $priorityX = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'normal':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'non-urgent':
- 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
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Modification of the following condition will violate the license!
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function from($address, $name = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function to($address, $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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->addReplyTo($this->smtp['reply_to']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priority = 'Urgent';
- 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
$this->mailer->isQmail();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Normal':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'High':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($priority) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->AddCustomHeader('Priority', $priority);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->Host = $this->smtp['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 $this mailer object itself
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->Port = $this->smtp['port'];
- 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 ($this->smtp['from_name']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function content($message)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->params['from'][$address] = $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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priorityX = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Low':
- 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
$this->params['subject'] = $this->mailer->Subject = $subject;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->params['body'] = $message;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $address
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->params['to'][$address] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->smtp['options']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->FromName = $this->smtp['from_name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$unsubscribe .= "<$row>,";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->smtp['confirm_reading_to']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->isHTML(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- 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
$this->mailer->SMTPSecure = $this->smtp['secure'];
- 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
switch ($this->smtp['priority']) {
- 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 $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->smtp['port'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priority = $priorityName = 'Normal';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$priority = 'Non-Urgent';
- 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 $subject
- 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
$this->mailer->msgHTML($message);
- 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 $address The email address to send to
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add a "CC" address.
- 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 $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- 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
static::$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
*
- 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
$attachments = Json::decode($rowQueue['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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check connection.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$attachmentsToRemove = $update = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function bcc($address, $name = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name Overrides the attachment name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setParams(['mailer' => $this]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('MailerAfterSend');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::error('Mailer Error: ' . \print_r($this->mailer->ErrorInfo, true), 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->Debugoutput = function ($str, $level) {
- 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 (is_numeric($email)) {
- 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 ($this->mailer->send()) {
- 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 function test()
- 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 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
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
$mailer->attachment($path, $name);
- 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
Log::error(trim($str), 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Log::trace(trim($str), 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$templateId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['result' => false, 'error' => Language::translate('LBL_NO_EMAIL_TEMPLATE')];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->content($textParser->setContent($template['content'])->parse()->getContent());
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$mailer = (new self())->loadSmtpByID($rowQueue['smtp_id'])->subject($rowQueue['subject'])->content($rowQueue['content']);
- 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 $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty(static::$error)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== strpos(strtolower($str), 'error') || false !== strpos(strtolower($str), 'failed')) {
- 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
$currentUser = \Users_Record_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->to($currentUser->get('email1'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function sendByRowQueue($rowQueue)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mailer = (new self())->loadSmtpByID($rowQueue['smtp_id'])->subject($rowQueue['subject'])->content($rowQueue['content']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$email = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mailer->{$key}($email, $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
* @note: This function works with the SMTP mailer on win32, not with the "mail" mailer.
- 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 $address The email address to reply to
- 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("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->saveMail();
- 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
$this->mailer->SMTPDebug = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $rowQueue
- 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
$mailer->from($from['email'], $from['name']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($rowQueue['attachments']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$attachments = array_merge($attachments, Mail::getAttachmentsFromDocument($attachments['ids']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (strpos(realpath($path), 'cache' . \DIRECTORY_SEPARATOR)) {
- 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
$this->params['attachment'][$path] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->addAttachment($path, $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
if (\is_array($this->mailer->ErrorInfo)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$error[] = $this->mailer->ErrorInfo;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->subject($textParser->setContent($template['subject'])->parse()->getContent());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['result' => $this->send(), 'error' => implode(PHP_EOL, static::$error)];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($rowQueue[$key]) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- 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
* Add a "Reply-To" address.
- 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 $path Path to the attachment
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- 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("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- 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
Log::trace('Mailer sent mail', 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (Json::decode($rowQueue[$key]) as $email => $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($attachments['ids']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($attachments as $path => $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$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
$this->mailer->addBCC($address, $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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function attachment($path, $name = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create a message and send it.
- 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
$template = Mail::getTemplate($templateId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function replyTo($address, $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
$eventHandler->trigger('MailerBeforeSend');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$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
static::$error[] = trim($str);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$textParser = TextParser::getInstanceById($currentUser->getId(), 'Users');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (['cc', 'bcc'] as $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->params['replyTo'][$address] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->mailer->addReplyTo($address, $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
$eventHandler = new EventHandler();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->mailer->ErrorInfo as $error) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Send mail by row queue.
- 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 ($rowQueue['from']) {
- 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 $address The email address to send to
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return $this mailer object itself
- 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 an attachment from a path on the filesystem.
- 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 function send(): 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
if (is_numeric($path)) {
- 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
$toAddresses = $this->mailer->From . ' >> ' . \print_r($this->mailer->getToAddresses(), true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->smtp['save_send_mail'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile("Mailer::send|{$toAddresses}", 'Mail|SMTP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$error[] = $error;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('MailerAfterSendError');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('demo' === \App\Config::main('systemMode')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($attachments['ids'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$path = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->params['bcc'][$address] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- 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
$templateId = Mail::getTemplateIdFromSysName('TestMailAboutTheMailServerConfiguration');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$from = Json::decode($rowQueue['from']);
- 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
$this->mailer->Ical = $this->params['ics'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'imap_open_add_connection_type' => true,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \App\Mailer
- 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 ($emails as $email => $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
$update['status'] = 2;
- 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($this->params['ics'])) {
- 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
Log::error('Mailer Error: No smtp data entered', 'Mailer');
- 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
$update['to'] = Json::encode($emails);
- 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
imap_append($mbox, \OSSMail_Record_Model::$imapConnectMailbox, $this->mailer->getSentMIMEMessage(), '\\Seen');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$separateMailer->to($email, $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
$db->createCommand()->update('s_#__mail_queue', $update, ['id' => $rowQueue['id']])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setCustomParams(array $params): void
- 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_append', '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
$attachmentsToRemove[] = $path;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_numeric($email)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$email = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->params['params'] = $params;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
if (empty($this->smtp['smtp_username']) && empty($this->smtp['smtp_password']) && empty($this->smtp['smtp_host'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->smtp['smtp_username'],
- 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
public function cloneMailer()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Adding additional 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
public function saveMail()
- 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
unlink($file);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$update['error'] = implode(PHP_EOL, static::$error);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $params
- 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 $this->params;
- 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
Log::error('Mailer Error: IMAP error - ' . imap_last_error(), 'Mailer');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$clonedThis = clone $this;
- 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
$mailer->to($email, $name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($status) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->smtp['smtp_username']) && empty($this->smtp['smtp_password']) && empty($this->smtp['smtp_host'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'imap_params' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$email = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = $separateMailer->send();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$status) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (is_numeric($email)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $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
*
- 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
$folder = Utils::convertCharacterEncoding($this->smtp['smtp_folder'], 'UTF-8', 'UTF7-IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->smtp['smtp_host'] . ':' . $this->smtp['smtp_port'], $folder, false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($rowQueue['params'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emails[$email] = $name;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (Json::decode($rowQueue['to']) as $email => $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
* @return void
- 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
static::$error[] = 'IMAP error - ' . imap_last_error();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::endProfile(__METHOD__ . '|imap_append', 'Mail|IMAP');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Clone the mailer object for individual shipment.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $clonedThis;
- 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 (Json::decode($rowQueue['to']) as $email => $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$name = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$status = $mailer->send();
- 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
* Save sent email.
- 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
Encryption::getInstance()->decrypt($this->smtp['smtp_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
if ($mailer->getSmtp('individual_delivery')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$separateMailer = $mailer->cloneMailer();
- 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
} 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
$db = Db::getInstance('admin');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCustomParams(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mbox = \OSSMail_Record_Model::imapConnect(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get additional 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
/**
- 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
foreach ($attachmentsToRemove as $file) {
- 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
'imap_max_retries' => 0,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$clonedThis->mailer = clone $this->mailer;
- 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
$mailer->setCustomParams(Json::decode($rowQueue['params']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emails = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($separateMailer, $emails[$email]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($mailer);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->delete('s_#__mail_queue', ['id' => $rowQueue['id']])->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
* @throws \App\Exceptions\AppException
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'validate_cert' => !empty($this->smtp['smtp_validate_cert']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $mbox && !imap_last_error()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks