chamilo/chamilo-lms

View on GitHub
src/CoreBundle/ServiceHelper/MailHelper.php

Summary

Maintainability
A
0 mins
Test Coverage

The method send() has an NPath complexity of 5648. The configured NPath complexity threshold is 200.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

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 send has 11 parameters. Consider reducing the number of parameters to less than 10.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

Avoid unused parameters such as '$embeddedImage'.
Open

        bool $embeddedImage = false,

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

The parameter $extra_headers is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

The parameter $data_file is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseParameterName

Since: 0.2

It is considered best practice to use the camelCase notation to name parameters.

Example

class ClassName {
    public function doSomething($user_name) {
    }
}

Source

Variable "data_file" is not in valid camel caps format
Open

            if (!empty($data_file)) {

Variable "file_attach" is not in valid camel caps format
Open

                foreach ($data_file as $file_attach) {

Variable "file_attach" is not in valid camel caps format
Open

                        $templatedEmail->attachFromPath($file_attach['path'], $file_attach['filename']);

Variable "extra_headers" is not in valid camel caps format
Open

            $replyToName = $extra_headers['reply_to']['name'];

Variable "extra_headers" is not in valid camel caps format
Open

            !empty($extra_headers['reply_to']) ? $extra_headers['reply_to'] : []

Variable "extra_headers" is not in valid camel caps format
Open

        if (isset($extra_headers['reply_to'])) {

Variable "file_attach" is not in valid camel caps format
Open

                        $templatedEmail->addPart(new DataPart($file_attach['stream'], $file_attach['filename']));

Add a single space around assignment operators
Open

declare(strict_types=1);

Missing function doc comment
Open

    public function __construct(

Variable "data_file" is not in valid camel caps format
Open

                foreach ($data_file as $file_attach) {

Variable "extra_headers" is not in valid camel caps format
Open

            $replyToEmail = $extra_headers['reply_to']['mail'];

Variable "file_attach" is not in valid camel caps format
Open

                    if (!empty($file_attach['stream']) && !empty($file_attach['filename'])) {

Variable "file_attach" is not in valid camel caps format
Open

                        $templatedEmail->addPart(new DataPart($file_attach['stream'], $file_attach['filename']));

Missing class doc comment
Open

final class MailHelper

Missing function doc comment
Open

    public function send(

Variable "data_file" is not in valid camel caps format
Open

        array $data_file = [],

Closing brace must be on a line by itself
Open

    ) {}

Variable "file_attach" is not in valid camel caps format
Open

                    if (!empty($file_attach['path']) && !empty($file_attach['filename'])) {

Variable "file_attach" is not in valid camel caps format
Open

                    if (!empty($file_attach['stream']) && !empty($file_attach['filename'])) {

Variable "file_attach" is not in valid camel caps format
Open

                    if (!empty($file_attach['path']) && !empty($file_attach['filename'])) {

Variable "extra_headers" is not in valid camel caps format
Open

        array $extra_headers = [],

Variable "file_attach" is not in valid camel caps format
Open

                        $templatedEmail->attachFromPath($file_attach['path'], $file_attach['filename']);

Variable "extra_headers" is not in valid camel caps format
Open

            !empty($extra_headers['reply_to']) ? $extra_headers['reply_to'] : []

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly MailerInterface $mailer,

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly ThemeHelper $themeHelper,

Closing brace must be on a line by itself
Open

    ) {}

Line indented incorrectly; expected 4 spaces, found 8
Open

        private readonly BodyRendererInterface $bodyRenderer,

The variable $extra_headers is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $data_file is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $data_file is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_headers is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_headers is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_headers is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $file_attach is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

The variable $extra_headers is not named in camelCase.
Open

    public function send(
        string $recipientName,
        string $recipientEmail,
        string $subject,
        string $body,

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

There are no issues that match your filters.

Category
Status