Completed
Push — master ( 155db8...3b1b7a )
by CodexShaper
24s queued 10s
created

PaymentMethod   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 29
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 4 4 1
A find() 4 4 1

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 Codexshaper\WooCommerce\Models;
4
5
use Codexshaper\WooCommerce\Facades\WooCommerce;
6
7 View Code Duplication
class PaymentMethod extends BaseModel
0 ignored issues
show
Duplication introduced by
This class 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...
8
{
9
    protected $endpoint = 'payment_gateways';
10
11
    /**
12
     * Retrieve all Items.
13
     *
14
     * @param array $options
15
     *
16
     * @return array
17
     */
18
    protected function all($options = [])
19
    {
20
        return WooCommerce::all($this->endpoint, $options);
21
    }
22
23
    /**
24
     * Retrieve single Item.
25
     *
26
     * @param int   $id
27
     * @param array $options
28
     *
29
     * @return object
30
     */
31
    protected function find($id, $options = [])
32
    {
33
        return WooCommerce::find("{$this->endpoint}/{$id}", $options);
34
    }
35
}
36