features/links/lib.php

Summary

Maintainability
A
35 mins
Test Coverage

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

    static function undelete_forum_links_for_event($event_id, $conn = null) {
        $conn = $conn ?: Persistence::get_database_object();
        $table_name = 'forum_links';
        if (is_null($conn)) {
            return array("status" => self::ERROR,
Severity: Major
Found in features/links/lib.php and 4 other locations - About 35 mins to fix
features/images/lib.php on lines 122..130
features/irc/lib.php on lines 139..147
features/jira/lib.php on lines 122..130
features/slack/lib.php on lines 322..330

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 76.

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

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class Links {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Method name "Links::get_forum_link" is not in camel caps format
Open

    static function get_forum_link($theid, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Visibility must be declared on method "get_forum_links_for_event"
Open

    static function get_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Opening brace of a class must be on the line after the definition
Open

class Links {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Method name "Links::save_forum_links" is not in camel caps format
Open

    static function save_forum_links($forum_links, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Visibility must be declared on method "delete_forum_link"
Open

    static function delete_forum_link($theid, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Visibility must be declared on method "undelete_forum_links_for_event"
Open

    static function undelete_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Method name "Links::delete_forum_link" is not in camel caps format
Open

    static function delete_forum_link($theid, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Method name "Links::get_forum_links_for_event" is not in camel caps format
Open

    static function get_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Visibility must be declared on method "save_forum_links"
Open

    static function save_forum_links($forum_links, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Visibility must be declared on method "get_forum_link"
Open

    static function get_forum_link($theid, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Visibility must be declared on method "delete_forum_links_for_event"
Open

    static function delete_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Method name "Links::delete_forum_links_for_event" is not in camel caps format
Open

    static function delete_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Method name "Links::undelete_forum_links_for_event" is not in camel caps format
Open

    static function undelete_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Opening brace should be on a new line
Open

    static function delete_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Opening brace should be on a new line
Open

    static function delete_forum_link($theid, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Opening brace should be on a new line
Open

    static function get_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Line indented incorrectly; expected at least 12 spaces, found 10
Open

          $forum = Persistence::save_forum($forum_links, $conn);
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Opening brace should be on a new line
Open

    static function get_forum_link($theid, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Line indented incorrectly; expected at least 12 spaces, found 10
Open

          return array("status" => self::ERROR, "error" => $e->getMessage());
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Opening brace should be on a new line
Open

    static function save_forum_links($forum_links, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

Opening brace should be on a new line
Open

    static function undelete_forum_links_for_event($event_id, $conn = null) {
Severity: Minor
Found in features/links/lib.php by phpcodesniffer

There are no issues that match your filters.

Category
Status