railpage/railpagecore

View on GitHub
lib/PrivateMessages/Folder.php

Summary

Maintainability
D
2 days
Test Coverage

Method getContents has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function getContents($page = 1, $items_per_page = 25) {
            if (empty($this->folder)) {
                throw new Exception("Cannot get folder contents - no folder specified"); 
            } 
            
Severity: Minor
Found in lib/PrivateMessages/Folder.php - About 1 hr to fix

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

            public function getContents($page = 1, $items_per_page = 25) {
                if (empty($this->folder)) {
                    throw new Exception("Cannot get folder contents - no folder specified"); 
                } 
                
    Severity: Minor
    Found in lib/PrivateMessages/Folder.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

    The method getContents() has an NPath complexity of 384. The configured NPath complexity threshold is 200.
    Open

            public function getContents($page = 1, $items_per_page = 25) {
                if (empty($this->folder)) {
                    throw new Exception("Cannot get folder contents - no folder specified"); 
                } 
                
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php by phpmd

    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 getContents() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
    Open

            public function getContents($page = 1, $items_per_page = 25) {
                if (empty($this->folder)) {
                    throw new Exception("Cannot get folder contents - no folder specified"); 
                } 
                
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php by phpmd

    CyclomaticComplexity

    Since: 0.1

    Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

    Example

    // Cyclomatic Complexity = 11
    class Foo {
    1   public function example() {
    2       if ($a == $b) {
    3           if ($a1 == $b1) {
                    fiddle();
    4           } elseif ($a2 == $b2) {
                    fiddle();
                } else {
                    fiddle();
                }
    5       } elseif ($c == $d) {
    6           while ($c == $d) {
                    fiddle();
                }
    7        } elseif ($e == $f) {
    8           for ($n = 0; $n < $h; $n++) {
                    fiddle();
                }
            } else {
                switch ($z) {
    9               case 1:
                        fiddle();
                        break;
    10              case 2:
                        fiddle();
                        break;
    11              case 3:
                        fiddle();
                        break;
                    default:
                        fiddle();
                        break;
                }
            }
        }
    }

    Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

    Avoid unused parameters such as '$page'.
    Open

            public function yieldConversations($items_per_page, $page) {
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php by phpmd

    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

    Avoid unused parameters such as '$items_per_page'.
    Open

            public function yieldConversations($items_per_page, $page) {
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php by phpmd

    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

    Avoid assigning values to variables in if clauses and the like (line '254', column '38').
    Open

            private function fetchMessages() {
    
                /**
                 * Caching
                 */
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php by phpmd

    IfStatementAssignment

    Since: 2.7.0

    Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

    Example

    class Foo
    {
        public function bar($flag)
        {
            if ($foo = 'bar') { // possible typo
                // ...
            }
            if ($baz = 0) { // always false
                // ...
            }
        }
    }

    Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                if (RP_DEBUG) {
                    $site_debug[] = "Railpage: " . __CLASS__ . "(" . $this->folder . ") instantiated in " . round(microtime(true) - $debug_timer_start_z, 5) . "s";
                }
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 2 hrs to fix
    lib/News/Article.php on lines 464..466

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                } elseif ($this->folder == PM_OUTBOX) {
                    $pm_folder_sql = "pm.privmsgs_from_userid = ".$this->User->id." AND (pm.privmsgs_type = ".PRIVMSGS_NEW_MAIL." OR pm.privmsgs_type = ".PRIVMSGS_UNREAD_MAIL.")"; 
                } elseif ($this->folder == PM_SENTBOX) {
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 2 hrs to fix
    lib/PrivateMessages/Folder.php on lines 197..199

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

                } elseif ($this->folder == PM_SENTBOX) {
                    $pm_folder_sql = "pm.privmsgs_from_userid = ".$this->User->id." AND (pm.privmsgs_type = ".PRIVMSGS_READ_MAIL." OR pm.privmsgs_type = ".PRIVMSGS_SENT_MAIL.")"; 
                } elseif ($this->folder == PM_SAVEBOX) {
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 2 hrs to fix
    lib/PrivateMessages/Folder.php on lines 195..197

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                uasort($return['messages'], function($a, $b) {
                    return strnatcmp($b['privmsgs_date'], $a['privmsgs_date']); 
                });
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 1 hr to fix
    lib/Locos/LocoClass.php on lines 536..538

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    $row['user_avatar_from'] = function_exists("format_avatar") ? format_avatar($row['user_avatar_from'], 40, 40) : $row['user_avatar_from']; 
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 1 hr to fix
    lib/PrivateMessages/Folder.php on lines 228..228

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                    $row['user_avatar_to'] = function_exists("format_avatar") ? format_avatar($row['user_avatar_to'], 40, 40) : $row['user_avatar_to']; 
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 1 hr to fix
    lib/PrivateMessages/Folder.php on lines 227..227

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

                    $row['privmsgs_subject'] = str_replace("Re: ", "", $row['privmsgs_subject']);
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 6 other locations - About 55 mins to fix
    lib/Newsletters/Weekly.php on lines 408..408
    lib/Prerender/Home.php on lines 153..153
    lib/RSS/Consume.php on lines 279..279
    lib/RSS/Consume.php on lines 280..280
    lib/RSS/Consume.php on lines 364..364
    lib/Template.php on lines 292..292

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 28.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 12 locations. Consider refactoring.
    Open

                if (RP_DEBUG) {
                    global $site_debug;
                    $debug_timer_start_z = microtime(true);
                }
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 11 other locations - About 55 mins to fix
    lib/Events/Event.php on lines 341..344
    lib/Events/Event.php on lines 381..384
    lib/Forums/Post.php on lines 434..437
    lib/Forums/Thread.php on lines 209..212
    lib/Images/Image.php on lines 611..614
    lib/Links/Links.php on lines 278..281
    lib/News/Article.php on lines 365..368
    lib/News/Base.php on lines 310..313
    lib/API.php on lines 128..131
    lib/API.php on lines 260..263
    lib/Template.php on lines 332..335

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 28.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                $mckey = sprintf("railpage:privatemessages;user_id=%d;folder=%s", $this->User->id, $this->folder);
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 45 mins to fix
    lib/Chronicle/Entry.php on lines 178..178

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 26.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                $this->url = new Url(sprintf("/messages/%s", $folder));
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php and 1 other location - About 45 mins to fix
    lib/Forums/Forum.php on lines 189..189

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 26.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 22 locations. Consider refactoring.
    Open

                        $this->Redis->save($mckey, $folderContents, strtotime("+12 hours"));
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 21 other locations - About 40 mins to fix
    lib/Chronicle/Chronicle.php on lines 119..119
    lib/Config/Base.php on lines 40..40
    lib/Config/Base.php on lines 111..111
    lib/Downloads/Download.php on lines 530..530
    lib/Glossary/Glossary.php on lines 107..107
    lib/Images/Images.php on lines 110..110
    lib/Links/Links.php on lines 94..94
    lib/Links/Links.php on lines 129..129
    lib/Locations/Country.php on lines 179..179
    lib/Locations/Country.php on lines 180..180
    lib/Locations/Location.php on lines 811..811
    lib/Locations/Locations.php on lines 76..76
    lib/Locations/Locations.php on lines 127..127
    lib/Locations/Locations.php on lines 161..161
    lib/Locations/Locations.php on lines 474..474
    lib/Locos/Locomotive.php on lines 1227..1227
    lib/Locos/Locomotive.php on lines 1538..1538
    lib/Locos/Locos.php on lines 238..238
    lib/Users/Base.php on lines 82..82
    lib/Users/Timeline.php on lines 241..241
    lib/Place.php on lines 600..600

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 24.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

                $query = "SELECT pm.*, pmt.*, ufrom.username AS username_from, ufrom.user_id AS user_id_from, ufrom.user_avatar AS user_avatar_from, 
                                uto.username AS username_to, uto.user_id AS user_id_from, uto.user_avatar AS user_avatar_to
                            FROM nuke_bbprivmsgs AS pm
                                INNER JOIN nuke_bbprivmsgs_text AS pmt ON pm.privmsgs_id = pmt.privmsgs_text_id
                                INNER JOIN nuke_users AS ufrom ON ufrom.user_id = privmsgs_from_userid
    Severity: Major
    Found in lib/PrivateMessages/Folder.php and 4 other locations - About 40 mins to fix
    lib/Formatting/Html.php on lines 63..63
    lib/Images/Utility/Geoplace.php on lines 50..59
    lib/Locos/Locomotive.php on lines 1047..1047
    lib/SiteMessage/Admin.php on lines 35..35

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 23.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    The parameter $items_per_page is not named in camelCase.
    Open

            public function getContents($page = 1, $items_per_page = 25) {
                if (empty($this->folder)) {
                    throw new Exception("Cannot get folder contents - no folder specified"); 
                } 
                
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php by phpmd

    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 $items_per_page is not named in camelCase.
    Open

            public function yieldConversations($items_per_page, $page) {
                if (!$this->User instanceof User) {
                    throw new Exception("Cannot fetch " . __METHOD__ . " beause no user object has been set");
                }
                
    Severity: Minor
    Found in lib/PrivateMessages/Folder.php by phpmd

    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

    Function closing brace must go on the next line following the body; found 1 blank lines before brace
    Open

            }

    Function closing brace must go on the next line following the body; found 2 blank lines before brace
    Open

            }

    Expected 1 space after FUNCTION keyword; 0 found
    Open

                uasort($return['messages'], function($a, $b) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (count($folderContents) === 0) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public $cachepms = false;

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                });

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (RP_DEBUG) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            private function processConversations($conversations) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if ($this->folder == PM_INBOX) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public $folder; 

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    if ($this->cachepms) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (RP_DEBUG) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            private function generateSQLQuery() {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } elseif ($this->folder == PM_SENTBOX) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            private function fetchMessages() {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public $name;

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                foreach ($folderContents as $row) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (empty($this->folder)) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 0 spaces, found 4
    Open

        class Folder extends PrivateMessages {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (!$this->User instanceof User) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } elseif ($this->folder == PM_SAVEBOX) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (!$this->User->enable_privmsg) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public function __construct($folder = PM_INBOX) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (!$this->User instanceof User) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                if (!$this->cachepms || !$folderContents = $this->Redis->fetch($mckey)) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public function yieldConversations($items_per_page, $page) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                foreach ($conversations as $id => $row) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public function getContents($page = 1, $items_per_page = 25) {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } 

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                } elseif ($this->folder == PM_OUTBOX) {

    Line indented incorrectly; expected 0 spaces, found 4
    Open

        }

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 12 spaces, found 16
    Open

                    }

    There are no issues that match your filters.

    Category
    Status