File yf_email.class.php
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* High level html emails wrapper.
*/
Method _send_email_safe
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _send_email_safe($email_to, $name_to, $template_name, $data = [], $old_param1 = null, $override = [])
{
$is_test = (defined('TEST_MODE') && TEST_MODE)
&& empty($override['force_send'])
&& empty($this->FORCE_SEND);
Function _send_email_safe
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function _send_email_safe($email_to, $name_to, $template_name, $data = [], $old_param1 = null, $override = [])
{
$is_test = (defined('TEST_MODE') && TEST_MODE)
&& empty($override['force_send'])
&& empty($this->FORCE_SEND);
- 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 _send_email_to_user
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function _send_email_to_user($user_id, $template_name, $data = [], $instant_send = true, $require_verified_email = false, $is_wall_update = true, $template_group = '')
{
$instant_send = false;
$user_data = db()->from('user')->whereid($user_id)->get();
if (empty($user_data)) {
- 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 _send_copies
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function _send_copies($params = [])
{
if ( ! $params) {
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _get_email_text
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_email_text($replace = [], $extra = [])
{
if ($extra['tpl_name']) {
$lang = $extra['locale'] ?: conf('language');
$a = db()->from(self::table_tpls)->where('name', $extra['tpl_name'])->where('locale', $lang)->get();
Method _send_email_to_user
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _send_email_to_user($user_id, $template_name, $data = [], $instant_send = true, $require_verified_email = false, $is_wall_update = true, $template_group = '')
{
$instant_send = false;
$user_data = db()->from('user')->whereid($user_id)->get();
if (empty($user_data)) {
Method _send_copies
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _send_copies($params = [])
{
if ( ! $params) {
return false;
}
Function _get_email_text
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function _get_email_text($replace = [], $extra = [])
{
if ($extra['tpl_name']) {
$lang = $extra['locale'] ?: conf('language');
$a = db()->from(self::table_tpls)->where('name', $extra['tpl_name'])->where('locale', $lang)->get();
- 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 dequeue
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function dequeue($extra = [])
{
queue()->listen($this->QUEUE_NAME, function ($data) use ($extra) {
$data = json_decode($data, true);
if ($data) {
Method _send_email_to_user
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _send_email_to_user($user_id, $template_name, $data = [], $instant_send = true, $require_verified_email = false, $is_wall_update = true, $template_group = '')
Method _send_email_safe
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _send_email_safe($email_to, $name_to, $template_name, $data = [], $old_param1 = null, $override = [])
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return $this->_send_email_safe($user_data['email'], $user_data['name'], $template_name, $data, $instant_send);
Avoid too many return
statements within this method. Open
return false;