chartmogul/chartmogul-php

View on GitHub

Showing 13 of 13 total issues

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

public function connect($customerUUID, array $subscriptions)
{
$arr = [];
for ($i = 0; $i < count($subscriptions); $i++) {
$arr[$i] = $subscriptions[$i];
Severity: Major
Found in src/Subscription.php and 1 other location - About 3 hrs to fix
src/Subscription.php on lines 142..163

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

public function disconnect($customerUUID, array $subscriptions)
{
$arr = [];
for ($i = 0; $i < count($subscriptions); $i++) {
$arr[$i] = $subscriptions[$i];
Severity: Major
Found in src/Subscription.php and 1 other location - About 3 hrs to fix
src/Subscription.php on lines 112..133

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

protected function setLineItem($index, $line)
{
if ($line instanceof AbstractLineItem) {
$this->line_items[$index] = $line;
} elseif (is_array($line) && isset($line['type']) && $line['type'] === 'one_time') {
Severity: Major
Found in src/Invoice.php and 1 other location - About 2 hrs to fix
src/Invoice.php on lines 80..89

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

protected function setTransaction($index, $tr)
{
if ($tr instanceof AbstractTransaction) {
$this->transactions[$index] = $tr;
} elseif (is_array($tr) && isset($tr['type']) && $tr['type'] === 'payment') {
Severity: Major
Found in src/Invoice.php and 1 other location - About 2 hrs to fix
src/Invoice.php on lines 69..78

Customer has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Customer extends AbstractResource
{
use CreateTrait;
use AllTrait;
use GetTrait;
Severity: Minor
Found in src/Customer.php - About 2 hrs to fix

    File Customer.php has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
     
    namespace ChartMogul;
     
    use ChartMogul\Resource\AbstractResource;
    Severity: Minor
    Found in src/Customer.php - About 2 hrs to fix

      Method handleResponse has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      public function handleResponse(ResponseInterface $response)
      {
      $response->getBody()->rewind();
      $data = json_decode($response->getBody()->getContents(), true);
      switch ($response->getStatusCode()) {
      Severity: Minor
      Found in src/Http/Client.php - About 1 hr to fix

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

        <?php
         
        namespace ChartMogul\Metrics;
         
        use ChartMogul\Resource\AbstractResource;
        Severity: Major
        Found in src/Metrics/AllKeyMetrics.php and 3 other locations - About 1 hr to fix
        src/Metrics/Activities.php on lines 1..38
        src/Metrics/Customers/Activities.php on lines 1..38
        src/Metrics/Customers/Subscriptions.php on lines 1..38

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

        <?php
         
        namespace ChartMogul\Metrics\Customers;
         
        use ChartMogul\Resource\AbstractResource;
        Severity: Major
        Found in src/Metrics/Customers/Subscriptions.php and 3 other locations - About 1 hr to fix
        src/Metrics/Activities.php on lines 1..38
        src/Metrics/AllKeyMetrics.php on lines 1..38
        src/Metrics/Customers/Activities.php on lines 1..38

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

        <?php
         
        namespace ChartMogul\Metrics;
         
        use ChartMogul\Resource\AbstractResource;
        Severity: Major
        Found in src/Metrics/Activities.php and 3 other locations - About 1 hr to fix
        src/Metrics/AllKeyMetrics.php on lines 1..38
        src/Metrics/Customers/Activities.php on lines 1..38
        src/Metrics/Customers/Subscriptions.php on lines 1..38

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

        <?php
         
        namespace ChartMogul\Metrics\Customers;
         
        use ChartMogul\Resource\AbstractResource;
        Severity: Major
        Found in src/Metrics/Customers/Activities.php and 3 other locations - About 1 hr to fix
        src/Metrics/Activities.php on lines 1..38
        src/Metrics/AllKeyMetrics.php on lines 1..38
        src/Metrics/Customers/Subscriptions.php on lines 1..38

        Method unmerge has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        public static function unmerge($customer_uuid, $external_id, $data_source_uuid, array $move_to_new_customer = [], ?ClientInterface $client = null)
        Severity: Minor
        Found in src/Customer.php - About 35 mins to fix

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

          public static function allData(array $data, Collection $array)
          {
          if (isset($data["current_page"])) {
          $array->current_page = $data["current_page"];
          }
          Severity: Minor
          Found in src/Resource/AbstractResource.php - About 25 mins to fix
          Severity
          Category
          Status
          Source
          Language