luyadev/luya-mailjet

View on GitHub

Showing 13 of 13 total issues

MailerMessage has 39 functions (exceeds 20 allowed). Consider refactoring.
Open

class MailerMessage extends BaseMessage
{
    private $_charset;
    
    private $_from;
Severity: Minor
Found in src/MailerMessage.php - About 5 hrs to fix

    Function init has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function init()
        {
            parent::init();
    
    
    
    Severity: Minor
    Found in src/widgets/SubscribeFormWidget.php - About 2 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 extractMessage has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function extractMessage(MailerMessage $message)
        {
            $array = [
                'From' => $message->getFrom(),
                'To' => $message->getTo(),
    Severity: Minor
    Found in src/Mailer.php - About 1 hr to fix

      Method items has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function items($listId = null, $isExcludedFromCampaigns = null)
          {
              // setup limit
              $limit = 100;
              // prepare filters
      Severity: Minor
      Found in src/Contacts.php - About 1 hr to fix

        Method create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function create($name, $mjml)
            {
                $this->_errorMessage = false;
        
                $json = Mjml::getArray($mjml);
        Severity: Minor
        Found in src/Sections.php - About 1 hr to fix

          Method init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function init()
              {
                  parent::init();
          
          
          
          Severity: Minor
          Found in src/widgets/SubscribeFormWidget.php - About 1 hr to fix

            Method mjmlToArray has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function mjmlToArray($mjml)
                {
                    $parser = xml_parser_create();
                    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
                    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
            Severity: Minor
            Found in src/Mjml.php - About 1 hr to fix

              Function mjmlToArray has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function mjmlToArray($mjml)
                  {
                      $parser = xml_parser_create();
                      xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
                      xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
              Severity: Minor
              Found in src/Mjml.php - About 55 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

              Method send has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function send($text, $to, $from, $validate = false, $throwException = false)
              Severity: Minor
              Found in src/Sms.php - About 35 mins to fix

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

                    public function processConfirmLink()
                    {
                        $widgetId = Yii::$app->request->get('w');
                        $subscribe = Yii::$app->request->get('subscribe');
                
                
                Severity: Minor
                Found in src/widgets/SubscribeFormWidget.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 send has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function send($text, $to, $from, $validate = false, $throwException = false)
                    {
                        if ($validate) {
                            $model = new DynamicModel(compact('to', 'from'));
                            $model->addRule(['from'], 'string', ['min' => 3, 'max' => 11]);
                Severity: Minor
                Found in src/Sms.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 wrapCdataForRawElements has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function wrapCdataForRawElements($content)
                    {
                        foreach ($this->rawElements as $name) {
                            // save the replacmenets which are done in order to ensure no double replacements happens.
                            $doneReplacements = [];
                Severity: Minor
                Found in src/Mjml.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

                Function items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function items($listId = null, $isExcludedFromCampaigns = null)
                    {
                        // setup limit
                        $limit = 100;
                        // prepare filters
                Severity: Minor
                Found in src/Contacts.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

                Severity
                Category
                Status
                Source
                Language