Code Duplication    Length = 15-17 lines in 3 locations

catalog/admin/includes/modules/dashboard/d_latest_addons.php 1 location

@@ 42-56 (lines=15) @@
39
40
      $addonsCache = new Cache('oscommerce_website-addons-latest5');
41
42
      if ($addonsCache->exists(360)) {
43
        $entries = $addonsCache->get();
44
      } else {
45
        $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&GetLatestAddons']);
46
47
        if (!empty($response)) {
48
          $response = json_decode($response, true);
49
50
          if (is_array($response) && (count($response) === 5)) {
51
            $entries = $response;
52
          }
53
        }
54
55
        $addonsCache->save($entries);
56
      }
57
58
      $output = '<table class="table table-hover">
59
                   <thead>

catalog/admin/includes/modules/dashboard/d_latest_news.php 1 location

@@ 42-56 (lines=15) @@
39
40
      $newsCache = new Cache('oscommerce_website-news-latest5');
41
42
      if ($newsCache->exists(360)) {
43
        $entries = $newsCache->get();
44
      } else {
45
        $response = HTTP::getResponse(['url' => 'https://www.oscommerce.com/index.php?RPC&GetLatestNews']);
46
47
        if (!empty($response)) {
48
          $response = json_decode($response, true);
49
50
          if (is_array($response) && (count($response) === 5)) {
51
            $entries = $response;
52
          }
53
        }
54
55
        $newsCache->save($entries);
56
      }
57
58
      $output = '<table class="table table-hover">
59
                   <thead>

catalog/admin/includes/modules/dashboard/d_partner_news.php 1 location

@@ 77-93 (lines=17) @@
74
75
      $NewsCache = new Cache('oscommerce_website-partner_news');
76
77
      if ($NewsCache->exists(60)) {
78
        $result = $NewsCache->get();
79
      } else {
80
        $response = HTTP::getResponse([
81
          'url' => 'https://www.oscommerce.com/index.php?RPC&Website&Index&GetPartnerStatusUpdates'
82
        ]);
83
84
        if (!empty($response)) {
85
          $response = json_decode($response, true);
86
87
          if (is_array($response) && !empty($response)) {
88
            $result = $response;
89
90
            $NewsCache->save($result);
91
          }
92
        }
93
      }
94
95
      return $result;
96
    }