barbushin/php-imap

View on GitHub

Showing 27 of 41 total issues

Method __construct has 7 arguments (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(string $imapPath, string $login, string $password, string $attachmentsDir = null, string $serverEncoding = 'UTF-8', bool $trimImapPath = true, bool $attachmentFilenameMode = false)
Severity: Major
Found in src/PhpImap/Mailbox.php - About 45 mins to fix

    Function flattenParts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function flattenParts(array $messageParts, array $flattenedParts = [], string $prefix = '', int $index = 1, bool $fullPrefix = true): array
        {
            foreach ($messageParts as $part) {
                $flattenedParts[$prefix.$index] = $part;
                if (isset($part->parts)) {
    Severity: Minor
    Found in src/PhpImap/Mailbox.php - About 45 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 open has 6 arguments (exceeds 5 allowed). Consider refactoring.
    Open

            string $mailbox,
            string $username,
            string $password,
            int $options = 0,
            int $n_retries = 0,
    Severity: Minor
    Found in src/PhpImap/Imap.php - About 35 mins to fix

      Method sort has 6 arguments (exceeds 5 allowed). Consider refactoring.
      Open

              $imap_stream,
              int $criteria,
              bool $reverse,
              int $options,
              string $search_criteria = null,
      Severity: Minor
      Found in src/PhpImap/Imap.php - About 35 mins to fix

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

            public static function sort(
                $imap_stream,
                int $criteria,
                bool $reverse,
                int $options,
        Severity: Minor
        Found in src/PhpImap/Imap.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 EnsureRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function EnsureRange(
                $msg_number,
                string $method,
                int $argument,
                bool $allow_sequence = false
        Severity: Minor
        Found in src/PhpImap/Imap.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 search has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function search(
                $imap_stream,
                string $criteria,
                int $options = SE_FREE,
                string $charset = null,
        Severity: Minor
        Found in src/PhpImap/Imap.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