GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Customer   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 87.5 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 14
loc 16
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A cnpj_cpf() 7 7 2
A email() 7 7 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace BoletoSimples;
4
5
class Customer extends BaseResource {
6 View Code Duplication
  public static function cnpj_cpf($cnpj_cpf) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
7
    if (!$cnpj_cpf) {
8
      throw new \Exception("Couldn't find ".get_called_class()." without an cnpj or cpf.");
9
    }
10
    $response = self::sendRequest('GET', 'customers/cnpj_cpf', ['query' => ['q' => $cnpj_cpf]]);
0 ignored issues
show
Bug introduced by
The method sendRequest() does not exist on BoletoSimples\Customer. Did you maybe mean _sendRequest()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
11
    return new Customer($response->json());
12
  }
13 View Code Duplication
  public static function email($email) {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
    if (!$email) {
15
      throw new \Exception("Couldn't find ".get_called_class()." without an email.");
16
    }
17
    $response = self::sendRequest('GET', 'customers/email', ['query' => ['q' => $email]]);
0 ignored issues
show
Bug introduced by
The method sendRequest() does not exist on BoletoSimples\Customer. Did you maybe mean _sendRequest()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
18
    return new Customer($response->json());
19
  }
20
}
21