GemsTracker/gemstracker-library

View on GitHub
classes/Gems/Snippets/Mail/TokenBulkMailFormSnippet.php

Summary

Maintainability
B
5 hrs
Test Coverage
F
0%

Function sendMail has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sendMail()
    {
        $mails = 0;
        $updates = 0;
        $sentMailAddresses = array();
Severity: Minor
Found in classes/Gems/Snippets/Mail/TokenBulkMailFormSnippet.php - About 3 hrs to fix

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 sendMail has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function sendMail()
    {
        $mails = 0;
        $updates = 0;
        $sentMailAddresses = array();
Severity: Minor
Found in classes/Gems/Snippets/Mail/TokenBulkMailFormSnippet.php - About 1 hr to fix

    Function createToText has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        private function createToText(array $tokenData, $disabled)
        {
            $menuFind = false;
    
            if ($disabled) {
    Severity: Minor
    Found in classes/Gems/Snippets/Mail/TokenBulkMailFormSnippet.php - About 35 mins to fix

    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 loadFormData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function loadFormData()
        {
            parent::loadFormData();
            //if (!isset($this->formData['to']) || !is_array($this->formData['to'])) {
            if (!$this->request->isPost()) {
    Severity: Minor
    Found in classes/Gems/Snippets/Mail/TokenBulkMailFormSnippet.php - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Avoid excessively long class names like Gems_Snippets_Mail_TokenBulkMailFormSnippet. Keep class name length under 40.
    Open

    class Gems_Snippets_Mail_TokenBulkMailFormSnippet extends \Gems_Snippets_Mail_MailFormSnippet
    {
        protected $identifier;
    
        protected $loader;

    LongClassName

    Since: 2.9

    Detects when classes or interfaces are declared with excessively long names.

    Example

    class ATooLongClassNameThatHintsAtADesignProblem {
    
    }
    
    interface ATooLongInterfaceNameThatHintsAtADesignProblem {
    
    }

    Source https://phpmd.org/rules/naming.html#longclassname

    There are no issues that match your filters.

    Category
    Status