pixelfed/pixelfed

View on GitHub
app/Util/ActivityPub/Helpers.php

Summary

Maintainability
F
1 wk
Test Coverage

File Helpers.php has 718 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace App\Util\ActivityPub;

use App\Instance;
Severity: Major
Found in app/Util/ActivityPub/Helpers.php - About 1 day to fix

    Function statusFirstOrFetch has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function statusFirstOrFetch($url, $replyTo = false)
        {
            $url = self::validateUrl($url);
            if ($url == false) {
                return;
    Severity: Minor
    Found in app/Util/ActivityPub/Helpers.php - About 1 day 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 statusFirstOrFetch has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function statusFirstOrFetch($url, $replyTo = false)
        {
            $url = self::validateUrl($url);
            if ($url == false) {
                return;
    Severity: Major
    Found in app/Util/ActivityPub/Helpers.php - About 6 hrs to fix

      Method storeStatus has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function storeStatus($url, $profile, $activity)
          {
              $originalUrl = $url;
              $id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($activity['url']);
              $url = isset($activity['url']) && is_string($activity['url']) ? self::pluckval($activity['url']) : self::pluckval($id);
      Severity: Major
      Found in app/Util/ActivityPub/Helpers.php - About 3 hrs to fix

        Function normalizeAudience has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function normalizeAudience($data, $localOnly = true)
            {
                if (! isset($data['to'])) {
                    return;
                }
        Severity: Minor
        Found in app/Util/ActivityPub/Helpers.php - About 3 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

        Function storeStatus has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function storeStatus($url, $profile, $activity)
            {
                $originalUrl = $url;
                $id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($activity['url']);
                $url = isset($activity['url']) && is_string($activity['url']) ? self::pluckval($activity['url']) : self::pluckval($id);
        Severity: Minor
        Found in app/Util/ActivityPub/Helpers.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 profileUpdateOrCreate has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function profileUpdateOrCreate($url)
            {
                $res = self::fetchProfileFromUrl($url);
                if (! $res || isset($res['id']) == false) {
                    return;
        Severity: Major
        Found in app/Util/ActivityPub/Helpers.php - About 2 hrs to fix

          Helpers has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Helpers
          {
              public static function validateObject($data)
              {
                  $verbs = ['Create', 'Announce', 'Like', 'Follow', 'Delete', 'Accept', 'Reject', 'Undo', 'Tombstone'];
          Severity: Minor
          Found in app/Util/ActivityPub/Helpers.php - About 2 hrs to fix

            Method importNoteAttachment has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function importNoteAttachment($data, Status $status)
                {
                    if (self::verifyAttachments($data) == false) {
                        // \Log::info('importNoteAttachment::failedVerification.', [$data['id']]);
                        $status->viewType();
            Severity: Minor
            Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

              Function profileUpdateOrCreate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function profileUpdateOrCreate($url)
                  {
                      $res = self::fetchProfileFromUrl($url);
                      if (! $res || isset($res['id']) == false) {
                          return;
              Severity: Minor
              Found in app/Util/ActivityPub/Helpers.php - About 1 hr 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 importNoteAttachment has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function importNoteAttachment($data, Status $status)
                  {
                      if (self::verifyAttachments($data) == false) {
                          // \Log::info('importNoteAttachment::failedVerification.', [$data['id']]);
                          $status->viewType();
              Severity: Minor
              Found in app/Util/ActivityPub/Helpers.php - About 1 hr 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 validateUrl has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function validateUrl($url)
                  {
                      if (is_array($url)) {
                          $url = $url[0];
                      }
              Severity: Minor
              Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

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

                    private static function storePoll($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id)
                    {
                        if (! isset($res['endTime']) || ! isset($res['oneOf']) || ! is_array($res['oneOf']) || count($res['oneOf']) > 4) {
                            return;
                        }
                Severity: Minor
                Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

                  Function validateUrl has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function validateUrl($url)
                      {
                          if (is_array($url)) {
                              $url = $url[0];
                          }
                  Severity: Minor
                  Found in app/Util/ActivityPub/Helpers.php - About 1 hr 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 getScope has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getScope($activity, $url)
                      {
                          $id = isset($activity['id']) ? self::pluckval($activity['id']) : self::pluckval($url);
                          $url = isset($activity['url']) ? self::pluckval($activity['url']) : self::pluckval($id);
                          $urlDomain = parse_url(self::pluckval($url), PHP_URL_HOST);
                  Severity: Minor
                  Found in app/Util/ActivityPub/Helpers.php - About 1 hr 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 normalizeAudience has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function normalizeAudience($data, $localOnly = true)
                      {
                          if (! isset($data['to'])) {
                              return;
                          }
                  Severity: Minor
                  Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

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

                        public static function verifyAttachments($data)
                        {
                            if (! isset($data['object']) || empty($data['object'])) {
                                $data = ['object' => $data];
                            }
                    Severity: Minor
                    Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

                      Method storePoll has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          private static function storePoll($profile, $res, $url, $ts, $reply_to, $cw, $scope, $id)
                      Severity: Major
                      Found in app/Util/ActivityPub/Helpers.php - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                if (config('instance.timeline.network.cached') &&
                                    $status->in_reply_to_id === null &&
                                    $status->reblog_of_id === null &&
                                    in_array($status->type, ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) &&
                                    $status->created_at->gt(now()->subHours(config('instance.timeline.network.max_hours_old'))) &&
                        Severity: Major
                        Found in app/Util/ActivityPub/Helpers.php - About 40 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return;
                          Severity: Major
                          Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                    return $valid;
                            Severity: Major
                            Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return $status;
                              Severity: Major
                              Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                    return;
                                Severity: Major
                                Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                      return false;
                                  Severity: Major
                                  Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                return;
                                    Severity: Major
                                    Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return;
                                      Severity: Major
                                      Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return $profile;
                                        Severity: Major
                                        Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return;
                                          Severity: Major
                                          Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                    return self::profileUpdateOrCreate($url);
                                            Severity: Major
                                            Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          return;
                                              Severity: Major
                                              Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                        return $o && isset($o['type']) && $o['type'] == 'Person';
                                                Severity: Major
                                                Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                              return;
                                                  Severity: Major
                                                  Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                        return false;
                                                    Severity: Major
                                                    Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                              return;
                                                      Severity: Major
                                                      Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                return $status;
                                                        Severity: Major
                                                        Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                      return;
                                                          Severity: Major
                                                          Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return;
                                                            Severity: Major
                                                            Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return;
                                                              Severity: Major
                                                              Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            return $url;
                                                                Severity: Major
                                                                Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                          return;
                                                                  Severity: Major
                                                                  Found in app/Util/ActivityPub/Helpers.php - About 30 mins to fix

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

                                                                        public static function profileFirstOrNew($url)
                                                                        {
                                                                            $url = self::validateUrl($url);
                                                                            if ($url == false) {
                                                                                return;
                                                                    Severity: Minor
                                                                    Found in app/Util/ActivityPub/Helpers.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

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

                                                                            if (config('autospam.live_filters.enabled')) {
                                                                                $filters = config('autospam.live_filters.filters');
                                                                                if (! empty($filters) && isset($res['content']) && ! empty($res['content']) && strlen($filters) > 3) {
                                                                                    $filters = array_map('trim', explode(',', $filters));
                                                                                    $content = $res['content'];
                                                                    Severity: Major
                                                                    Found in app/Util/ActivityPub/Helpers.php and 1 other location - About 4 hrs to fix
                                                                    app/Util/ActivityPub/Inbox.php on lines 200..215

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

                                                                    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

                                                                            if (is_array($data['to']) && ! empty($data['to'])) {
                                                                                foreach ($data['to'] as $to) {
                                                                                    if ($to == 'https://www.w3.org/ns/activitystreams#Public') {
                                                                                        $scope = 'public';
                                                                    
                                                                    
                                                                    Severity: Major
                                                                    Found in app/Util/ActivityPub/Helpers.php and 1 other location - About 1 hr to fix
                                                                    app/Util/ActivityPub/Helpers.php on lines 130..142

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

                                                                    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

                                                                            if (is_array($data['cc']) && ! empty($data['cc'])) {
                                                                                foreach ($data['cc'] as $cc) {
                                                                                    if ($cc == 'https://www.w3.org/ns/activitystreams#Public') {
                                                                                        $scope = 'unlisted';
                                                                    
                                                                    
                                                                    Severity: Major
                                                                    Found in app/Util/ActivityPub/Helpers.php and 1 other location - About 1 hr to fix
                                                                    app/Util/ActivityPub/Helpers.php on lines 116..128

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

                                                                    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 4 locations. Consider refactoring.
                                                                    Open

                                                                            if (isset($res['to']) == true) {
                                                                                if (is_array($res['to']) && in_array('https://www.w3.org/ns/activitystreams#Public', $res['to'])) {
                                                                                    $scope = 'public';
                                                                                }
                                                                                if (is_string($res['to']) && $res['to'] == 'https://www.w3.org/ns/activitystreams#Public') {
                                                                    Severity: Major
                                                                    Found in app/Util/ActivityPub/Helpers.php and 3 other locations - About 40 mins to fix
                                                                    app/Util/ActivityPub/Helpers.php on lines 347..354
                                                                    app/Util/ActivityPub/Helpers.php on lines 612..619
                                                                    app/Util/ActivityPub/Helpers.php on lines 621..628

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

                                                                    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 4 locations. Consider refactoring.
                                                                    Open

                                                                            if (isset($activity['to']) == true) {
                                                                                if (is_array($activity['to']) && in_array('https://www.w3.org/ns/activitystreams#Public', $activity['to'])) {
                                                                                    $scope = 'public';
                                                                                }
                                                                                if (is_string($activity['to']) && $activity['to'] == 'https://www.w3.org/ns/activitystreams#Public') {
                                                                    Severity: Major
                                                                    Found in app/Util/ActivityPub/Helpers.php and 3 other locations - About 40 mins to fix
                                                                    app/Util/ActivityPub/Helpers.php on lines 338..345
                                                                    app/Util/ActivityPub/Helpers.php on lines 347..354
                                                                    app/Util/ActivityPub/Helpers.php on lines 621..628

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

                                                                    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 4 locations. Consider refactoring.
                                                                    Open

                                                                            if (isset($res['cc']) == true) {
                                                                                if (is_array($res['cc']) && in_array('https://www.w3.org/ns/activitystreams#Public', $res['cc'])) {
                                                                                    $scope = 'unlisted';
                                                                                }
                                                                                if (is_string($res['cc']) && $res['cc'] == 'https://www.w3.org/ns/activitystreams#Public') {
                                                                    Severity: Major
                                                                    Found in app/Util/ActivityPub/Helpers.php and 3 other locations - About 40 mins to fix
                                                                    app/Util/ActivityPub/Helpers.php on lines 338..345
                                                                    app/Util/ActivityPub/Helpers.php on lines 612..619
                                                                    app/Util/ActivityPub/Helpers.php on lines 621..628

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

                                                                    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 4 locations. Consider refactoring.
                                                                    Open

                                                                            if (isset($activity['cc']) == true) {
                                                                                if (is_array($activity['cc']) && in_array('https://www.w3.org/ns/activitystreams#Public', $activity['cc'])) {
                                                                                    $scope = 'unlisted';
                                                                                }
                                                                                if (is_string($activity['cc']) && $activity['cc'] == 'https://www.w3.org/ns/activitystreams#Public') {
                                                                    Severity: Major
                                                                    Found in app/Util/ActivityPub/Helpers.php and 3 other locations - About 40 mins to fix
                                                                    app/Util/ActivityPub/Helpers.php on lines 338..345
                                                                    app/Util/ActivityPub/Helpers.php on lines 347..354
                                                                    app/Util/ActivityPub/Helpers.php on lines 612..619

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

                                                                    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

                                                                    There are no issues that match your filters.

                                                                    Category
                                                                    Status